Repository navigation
Do not inline collinear_chaining into get_chains - #655
Merged
Merged
Conversation
Collaborator
|
I’ve spent too much time benchmarking this change now, so I’ll just merge it because the diff is small. The difference is minute, but there seems to be one. I’m generally not so keen on overriding compiler decisions because the compiler usually knows better, and even if it helps now, it is possible that this optimization turns into a pessimization when we upgrade the compiler. But for now, it does improve things a tiny bit. We just need to re-benchmark this when we update the compiler. |
When collinear_chaining is inlined into get_chains, it seems the compiler generates a slower DP loop. Marking it #[inline(never)] seems to make chaining a tad faster. Output is unchanged. Speedup on an Apple M4 Max (rustc 1.97.0), -x, 1 thread, median of 3 runs: - chrY, 20 kb reads: chaining -3.0%, total mapping time -2.6% - fruit fly, 10 kb reads: chaining -3.6%, total mapping time -0.9% The measurements are from one machine and compiler (Apple M4 Max, rustc 1.97.0), so it may not hold across other environments.
marcelm
force-pushed
the
chaining-noinline
branch
from
October 14, 2026 13:30
6afd158 to
11976ac
Compare
Owner
Author
|
Sounds good! |
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.
When collinear_chaining is inlined into get_chains, it seems the compiler
generates a slower DP loop. Marking it #[inline(never)] seems to make
chaining a tad faster.
Output is unchanged.
Speedup on an Apple M4 Max (rustc 1.97.0), -x, 1 thread, median of 3 runs:
The measurements are from one machine and compiler (Apple M4 Max, rustc 1.97.0),
so it may not hold across other environments.