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

Unwind information performance improvements #30

Merged
merged 1 commit into from
May 1, 2024
Merged

Conversation

javierhonduco
Copy link
Owner

This commit:

  • sort the FDEs rather than the whole unwind information, which is a smaller vector. This showed no performance changes in benchmarks;
  • optimise the unwind info in-place. Most of the performance gains in this commits comes from this changes;

Wrote a benchmark with criterion.rs and saw a ~25% decrease in time spent building and optimising the unwind info.

Running benches/unwind_info.rs (target/release/deps/unwind_info-b3269dc277690031)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

Gnuplot not found, using plotters backend
unwind info + sorting   time:   [37.697 ms 39.061 ms 40.592 ms]
                        change: [-26.710% -23.315% -19.870%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  3 (3.00%) high mild
  5 (5.00%) high severe

For this test, this node.js binary was used

/home/javierhonduco/.vscode-server/cli/servers/Stable-e170252f762678dec6ca2cc69aba1570769a5d39/server/node: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=e034c66a6dc897492d6ecae6c6b046669f94ad96, with debug_info, not stripped, too many notes (256)

I am not commiting the benchmarks as I bumped into some rough edges with criterion and I am not sure if it's maintained anymore. Might be worth adding some benchmarks later on.

Test Plan

Compared the unwind info before and after this change for a bunch of executables.

This commit:
- sort the FDEs rather than the whole unwind information, which is a
  smaller vector. This showed no performance changes in benchmarks;
- optimise the unwind info in-place. Most of the performance gains in
  this commits comes from this changes;

Wrote a benchmark with criterion.rs and saw a ~25% decrease in time
spent building and optimising the unwind info.

```
Running benches/unwind_info.rs (target/release/deps/unwind_info-b3269dc277690031)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

Gnuplot not found, using plotters backend
unwind info + sorting   time:   [37.697 ms 39.061 ms 40.592 ms]
                        change: [-26.710% -23.315% -19.870%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  3 (3.00%) high mild
  5 (5.00%) high severe
```

For this test, this node.js binary was used
```
/home/javierhonduco/.vscode-server/cli/servers/Stable-e170252f762678dec6ca2cc69aba1570769a5d39/server/node: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=e034c66a6dc897492d6ecae6c6b046669f94ad96, with debug_info, not stripped, too many notes (256)
```

I am not commiting the benchmarks as I bumped into some rough edges with
criterion and I am not sure if it's maintained anymore. Might be worth
adding some benchmarks later on.

Test Plan
=========

Compared the unwind info before and after this change for a bunch of
executables.
@javierhonduco
Copy link
Owner Author

Something to note is that this performance win might be greater in memory-constrained hosts or CPU with smaller caches!

@javierhonduco javierhonduco merged commit 07677fb into main May 1, 2024
6 checks passed
@javierhonduco javierhonduco deleted the unwind-info-perf branch May 1, 2024 16: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