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

Add benchmark for ELF "str2symtab" creation #943

Merged
merged 1 commit into from
Dec 27, 2024

Conversation

d-e-s-o
Copy link
Collaborator

@d-e-s-o d-e-s-o commented Dec 27, 2024

Add a benchmark for the creation of our ELF "str2symtab". This creation should trigger a good chunk of our data structure traversing and "parsing" paths. The performance is roughly as follows:

  $ cargo bench --features=nightly -- bench_str2sym_creation
  > test elf::parser::tests::bench_str2sym_creation  ... bench:  26,023,493.50 ns/iter (+/- 644,362.62)

The main reason for the addition of the benchmark is to get an idea how much performance we lost due to recent ELF parser changes: both the introduction of 32 bit support as well as the logic for working with different backends is assumed to have some runtime impact. Backporting the benchmark on top of commit 4688aa0 ("cli: Rework tracing output") results in the following performance numbers before said ELF changes:

  $ cargo bench --features=nightly -- bench_str2sym_creation
  > test elf::parser::tests::bench_str2sym_creation  ... bench:  25,233,120.60 ns/iter (+/- 496,742.81)

The difference is reproducible, but arguably small and acceptable. We may be able to speed things up a bit more via the usage of smaller indexes.

Add a benchmark for the creation of our ELF "str2symtab". This creation
should trigger a good chunk of our data structure traversing and
"parsing" paths. The performance is roughly as follows:

  $ cargo bench --features=nightly -- bench_str2sym_creation
  > test elf::parser::tests::bench_str2sym_creation  ... bench:  26,023,493.50 ns/iter (+/- 644,362.62)

The main reason for the addition of the benchmark is to get an idea how
much performance we lost due to recent ELF parser changes: both the
introduction of 32 bit support as well as the logic for working with
different backends is assumed to have some runtime impact. Backporting
the benchmark on top of commit 4688aa0 ("cli: Rework tracing
output") results in the following performance numbers before said ELF
changes:

  $ cargo bench --features=nightly -- bench_str2sym_creation
  > test elf::parser::tests::bench_str2sym_creation  ... bench:  25,233,120.60 ns/iter (+/- 496,742.81)

The difference is reproducible, but arguably small and acceptable. We
may be able to speed things up a bit more via the usage of smaller
indexes.

Signed-off-by: Daniel Müller <[email protected]>
Copy link

codecov bot commented Dec 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.47%. Comparing base (3f4b694) to head (4b62532).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #943      +/-   ##
==========================================
- Coverage   94.58%   94.47%   -0.12%     
==========================================
  Files          57       57              
  Lines       10626    10644      +18     
==========================================
+ Hits        10051    10056       +5     
- Misses        575      588      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@d-e-s-o d-e-s-o merged commit 9d1978e into libbpf:main Dec 27, 2024
41 checks passed
@d-e-s-o d-e-s-o deleted the topic/bench-str2symtab branch December 27, 2024 19:02
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