perf: add #[inline] to Reader::read_event_impl chain (fixes #678) - #1012
Open
dhimasardinata wants to merge 1 commit into
Open
perf: add #[inline] to Reader::read_event_impl chain (fixes #678)#1012dhimasardinata wants to merge 1 commit into
dhimasardinata wants to merge 1 commit into
Conversation
Non-cascaded #[inline] breaks cross-crate inlining. read_event_into has #[inline] but calls read_event_impl/read_until_close without it. Bench on 1.3GB XML (issue tafia#678): master 5.94s -> inline 5.23s (-12%) -> always 4.23s (-28%) Even with lto=true still wins 4.62s -> 4.14s. Verif: cargo test --lib + cargo bench --bench microbenches read_event
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1012 +/- ##
==========================================
- Coverage 57.31% 55.16% -2.15%
==========================================
Files 46 51 +5
Lines 18197 18791 +594
==========================================
- Hits 10429 10366 -63
- Misses 7768 8425 +657
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #678
Non-cascaded
#[inline]breaks cross-crate inlining.read_event_into(src/reader/mod.rs:411) has#[inline]but callsread_event_impl(src/reader/mod.rs:1006) andread_until_close(src/reader/mod.rs:1013) without it.Bench on 1.3GB XML (from #678, Xeon, 10 runs):
Even with lto=true: 4.62s -> 4.14s (-10%)
This PR adds
#[inline](not always) to keep binary size conservative, matching maintainer preference.Verif:
cargo test --libpass (hot 8s)cargo bench --bench microbenches -- "read_event" --sample-size 10shows improvement on sample_rss.xml:194KRelated: #405, #718