Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: Use ainur.StreamReader instead of io.RuneReader #2304

Merged
merged 2 commits into from
Nov 27, 2023

Conversation

kakkoyun
Copy link
Member

@kakkoyun kakkoyun commented Nov 27, 2023

  • Use ainur.StreamReader instead of io.RuneReader
  • Fix tests

Benchmark

Old

oos: linux
goarch: amd64
pkg: github.com/parca-dev/parca-agent/pkg/runtime/nodejs
cpu: AMD Ryzen 9 5950X 16-Core Processor            
Benchmark_scanVersionBytes-32                100          11508930 ns/op           32162 B/op        178 allocs/op
Benchmark_scanVersionBytes-32                102          11422398 ns/op           32672 B/op        178 allocs/op
Benchmark_scanVersionBytes-32                100          11774011 ns/op           32991 B/op        178 allocs/op
Benchmark_scanVersionBytes-32                100          11629588 ns/op           32162 B/op        178 allocs/op
Benchmark_scanVersionBytes-32                102          12016436 ns/op           33038 B/op        178 allocs/op
Benchmark_scanVersionBytes-32                103          11492685 ns/op           32602 B/op        178 allocs/op
Benchmark_scanVersionBytes-32                102          11671819 ns/op           33038 B/op        178 allocs/op
Benchmark_scanVersionBytes-32                100          11675831 ns/op           32601 B/op        178 allocs/op
Benchmark_scanVersionBytes-32                100          11757764 ns/op           32601 B/op        178 allocs/op
Benchmark_scanVersionBytes-32                103          11512288 ns/op           32602 B/op        178 allocs/op
PASS
ok      github.com/parca-dev/parca-agent/pkg/runtime/nodejs     15.678s

New

goos: linux
goarch: amd64
pkg: github.com/parca-dev/parca-agent/pkg/runtime/nodejs
cpu: AMD Ryzen 9 5950X 16-Core Processor            
Benchmark_scanVersionBytes-32               1958            656223 ns/op           32144 B/op        174 allocs/op
Benchmark_scanVersionBytes-32               1585            727980 ns/op           32031 B/op        174 allocs/op
Benchmark_scanVersionBytes-32               2030            689447 ns/op           32172 B/op        174 allocs/op
Benchmark_scanVersionBytes-32               1796            670143 ns/op           32121 B/op        174 allocs/op
Benchmark_scanVersionBytes-32               1525            715696 ns/op           32209 B/op        174 allocs/op
Benchmark_scanVersionBytes-32               1504            715440 ns/op           32136 B/op        174 allocs/op
Benchmark_scanVersionBytes-32               1597            676401 ns/op           32100 B/op        174 allocs/op
Benchmark_scanVersionBytes-32               1540            695197 ns/op           32181 B/op        174 allocs/op
Benchmark_scanVersionBytes-32               1615            718022 ns/op           32097 B/op        174 allocs/op
Benchmark_scanVersionBytes-32               1591            688324 ns/op           32242 B/op        174 allocs/op
PASS
ok      github.com/parca-dev/parca-agent/pkg/runtime/nodejs     13.306s

Comparison

goos: linux
goarch: amd64
pkg: github.com/parca-dev/parca-agent/pkg/runtime/nodejs
cpu: AMD Ryzen 9 5950X 16-Core Processor
                     │    old.txt    │               new.txt               │
                     │    sec/op     │   sec/op     vs base                │
_scanVersionBytes-32   11650.7µ ± 1%   692.3µ ± 4%  -94.06% (p=0.000 n=10)

                     │   old.txt    │               new.txt               │
                     │     B/op     │     B/op      vs base               │
_scanVersionBytes-32   31.84Ki ± 1%   31.39Ki ± 0%  -1.42% (p=0.001 n=10)

                     │  old.txt   │              new.txt              │
                     │ allocs/op  │ allocs/op   vs base               │
_scanVersionBytes-32   178.0 ± 0%   174.0 ± 0%  -2.25% (p=0.000 n=10)

TODO

  • Remove checked in binary

Signed-off-by: Kemal Akkoyun [email protected]

goos: linux
goarch: amd64
pkg: github.com/parca-dev/parca-agent/pkg/runtime/nodejs
cpu: AMD Ryzen 9 5950X 16-Core Processor
                     │    old.txt    │               new.txt               │
                     │    sec/op     │   sec/op     vs base                │
_scanVersionBytes-32   11650.7µ ± 1%   692.3µ ± 4%  -94.06% (p=0.000 n=10)

                     │   old.txt    │               new.txt               │
                     │     B/op     │     B/op      vs base               │
_scanVersionBytes-32   31.84Ki ± 1%   31.39Ki ± 0%  -1.42% (p=0.001 n=10)

                     │  old.txt   │              new.txt              │
                     │ allocs/op  │ allocs/op   vs base               │
_scanVersionBytes-32   178.0 ± 0%   174.0 ± 0%  -2.25% (p=0.000 n=10)

Signed-off-by: Kemal Akkoyun <[email protected]>
Signed-off-by: Kemal Akkoyun <[email protected]>
@kakkoyun kakkoyun requested a review from a team as a code owner November 27, 2023 20:16
@kakkoyun kakkoyun force-pushed the optimize_data_section_scans_further_2 branch 2 times, most recently from 9f1019e to 61ad152 Compare November 27, 2023 20:27
@kakkoyun kakkoyun merged commit efa614f into main Nov 27, 2023
29 of 42 checks passed
@kakkoyun kakkoyun deleted the optimize_data_section_scans_further_2 branch November 27, 2023 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant