-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Inline some parser functions #94693
Inline some parser functions #94693
Conversation
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit b190b2221a849ea63821fb44f980f6d6bc3bd5cc with merge cdabcb0018ab49622ef6ecf1567eb2aee3bc19b0... |
Here are some local instruction count measurements, including a number of crates that aren't in the usual benchmark suite.
|
☀️ Try build successful - checks-actions |
Queued cdabcb0018ab49622ef6ecf1567eb2aee3bc19b0 with parent 3d1eaf4, future comparison URL. |
Finished benchmarking commit (cdabcb0018ab49622ef6ecf1567eb2aee3bc19b0): comparison url. Summary: This benchmark run did not return any relevant results. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf. @bors rollup=never |
r? @Aaron1011 The CI run was meh, but I think the improvements on the benchmarks outside of rustc-perf are clear enough for this to be worth doing, given that the changes are simple. |
Can it use inlined In the uninlined cases we don't really care whether it's inlined or not and can leave the decision to the compiler, but it would make the code cleaner, IMO. |
Could you also add short comments to the inlined versions telling that they are supposed to be used in especially hot contexts found by profiling? |
b190b22
to
5b6f5c9
Compare
I have made the requested changes. |
The call site within `Parser::bump` is hot. Also add an inline annotation to `Parser::next_tok`. It was already being inlined by the compiler; this just makes sure that continues.
5b6f5c9
to
f8f1d3f
Compare
I have updated again. |
Thanks! |
📌 Commit f8f1d3f has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (64137f0): comparison url. Summary: This benchmark run did not return any relevant results. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
Some crates that do a lot of complex declarative macro expansion spend a lot of time parsing (and reparsing) tokens. These commits inline some functions for some minor speed wins.
r? @ghost