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

gimli: Implement symbol table searches on macOS #300

Merged
merged 1 commit into from
Mar 3, 2020
Merged

Conversation

alexcrichton
Copy link
Member

If dwarf debug info isn't available we fall back to searching the symbol
table. Typically this is done with dladdr on most platforms but with
gimli we typically have all the infrastructure already in place to do
the search ourselves. This functionality was already filled out on
Linux and Windows, but it wasn't implemented on macOS yet because it
wasn't necessary.

Implementing a pretty simple version, however, shows substantial
speedups for the various benchmarks. Presumably dladdr isn't exactly
the fastest thing in the world and our sorted list search which is
cached must be much faster here!

The current comparison of before/after this change looks like:

 name                                 before ns/iter  after ns/iter  diff ns/iter   diff %  speedup
 new                                  81,472          9,047               -72,425  -88.90%   x 9.01
 new_unresolved                       2,126           2,009                  -117   -5.50%   x 1.06
 new_unresolved_and_resolve_separate  82,252          9,134               -73,118  -88.90%   x 9.01
 trace                                1,273           1,185                   -88   -6.91%   x 1.07
 trace_and_resolve_callback           67,403          2,123               -65,280  -96.85%  x 31.75
 trace_and_resolve_separate           76,452          2,822               -73,630  -96.31%  x 27.09

If dwarf debug info isn't available we fall back to searching the symbol
table. Typically this is done with `dladdr` on most platforms but with
gimli we typically have all the infrastructure already in place to do
the search ourselves. This functionality was already filled out on
Linux and Windows, but it wasn't implemented on macOS yet because it
wasn't necessary.

Implementing a pretty simple version, however, shows substantial
speedups for the various benchmarks. Presumably `dladdr` isn't exactly
the fastest thing in the world and our sorted list search which is
cached must be much faster here!

The current comparison of before/after this change looks like:

```
 name                                 before ns/iter  after ns/iter  diff ns/iter   diff %  speedup
 new                                  81,472          9,047               -72,425  -88.90%   x 9.01
 new_unresolved                       2,126           2,009                  -117   -5.50%   x 1.06
 new_unresolved_and_resolve_separate  82,252          9,134               -73,118  -88.90%   x 9.01
 trace                                1,273           1,185                   -88   -6.91%   x 1.07
 trace_and_resolve_callback           67,403          2,123               -65,280  -96.85%  x 31.75
 trace_and_resolve_separate           76,452          2,822               -73,630  -96.31%  x 27.09
```
@alexcrichton alexcrichton merged commit ac175e2 into master Mar 3, 2020
@alexcrichton alexcrichton deleted the macos-symtab branch March 3, 2020 20:15
Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2020
@RalfJung
Copy link
Member

RalfJung commented Mar 9, 2020

This PR seems likely responsible for a rustc test failure after bumping the libbacktrace version there: rust-lang/rust#69729 (comment)

EDIT: on second thought, #298 seems like the more likely candidate... let's discuss in rust-lang/rust#69729 (comment)

JohnTitor added a commit to JohnTitor/rust that referenced this pull request Mar 14, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 21, 2020
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.

None yet

2 participants