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

read: add EntriesRaw #455

Merged
merged 3 commits into from
Nov 26, 2019
Merged

read: add EntriesRaw #455

merged 3 commits into from
Nov 26, 2019

Conversation

philipc
Copy link
Collaborator

@philipc philipc commented Nov 25, 2019

Provides a raw reader of Debugging Information Entries. This is useful for users who require performance and don't need the niceties of EntriesCursor. Comparative benchmarks:

test bench_parsing_debug_info         ... bench:   1,733,047 ns/iter (+/- 63,346)
test bench_parsing_debug_info_raw     ... bench:   1,182,351 ns/iter (+/- 36,013)
test bench_parsing_debug_info_tree    ... bench:   1,836,409 ns/iter (+/- 57,726)

(Note: if you run the benchmarks yourself you'll see that bench_parsing_debug_info_with_endian_rc_slice is faster; this is due to differences in inlining.)

These benchmarks don't do anything with the attributes, so in practical applications the gains aren't this much, but they are still significant (I have tested in addr2line).

This is a micro-optimisation that gives about 1% improvement in
instruction counts, but the benchmark time difference is lost in
the noise.
@philipc philipc requested a review from fitzgen November 25, 2019 08:55
@coveralls
Copy link

coveralls commented Nov 25, 2019

Coverage Status

Coverage increased (+0.01%) to 86.505% when pulling 0b04978 on philipc:entries_raw into e516309 on gimli-rs:master.

@philipc
Copy link
Collaborator Author

philipc commented Nov 25, 2019

I probably should add a test too... tomorrow.

benches/bench.rs Outdated
while let Some(attr) = attrs.next().expect("Should parse entry's attribute") {
test::black_box(&attr);
loop {
match attrs.next() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of going from while let Some to loop + match?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It avoids a move of the attribute which the compiler fails to optimise away. But maybe this requires more explanation and deserves its own PR.

src/read/unit.rs Show resolved Hide resolved
@philipc philipc merged commit 1b7706b into gimli-rs:master Nov 26, 2019
@philipc philipc deleted the entries_raw branch November 26, 2019 10:27
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

3 participants