Split mp_binary_op into inlinable and non-inlinable variants. - #25
Merged
Conversation
mp's normal `mp_binary_op` inlines iterator comparisons for `contains`: the resultant `while` loop prevents `mp_binary_op` from being inlined in a trace. This commit breaks out the arbitrary-length `while` loop into a separate function: normal binary operations are now inlined, but list (etc.) comparisons aren't. The one exception is tuples: those _are_ inlined (and therefore unrolled), because they are almost always small and fixed in size. This speeds nearly everything up, if only by a bit: ``` BigLoop/ykmp/1000000000 227746 ± 976 136731 ± 5 0.60 39.96% faster Sieve/ykmp/3000 19497 ± 59 15379 ± 79 0.79 21.12% faster Queens/ykmp/1000 70252 ± 557 66450 ± 111 0.95 5.41% faster List/ykmp/1500 62093 ± 626 58845 ± 1500 0.95 5.23% faster Towers/ykmp/600 153793 ± 312 145922 ± 541 0.95 5.12% faster Richards/ykmp/100 355874 ± 361 337834 ± 693 0.95 5.07% faster Bounce/ykmp/1500 122221 ± 811 117012 ± 1106 0.96 4.26% faster Permute/ykmp/1000 133177 ± 171 128087 ± 329 0.96 3.82% faster CD/ykmp/250 209803 ± 1146 202455 ± 381 0.96 3.50% faster NBody/ykmp/250000 112451 ± 92 113991 ± 1165 1.01 1.37% slower Storage/ykmp/1000 112431 ±31069 88203 ± 293 0.78 indistinguishable Mandelbrot/ykmp/500 44276 ± 1156 42130 ± 1316 0.95 indistinguishable ```
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 29, 2026
|
Looks like test failed: |
Author
|
Yes, currently investigating. This is probably a deopt bug but not 100% sure yet. |
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.
mp's normal
mp_binary_opinlines iterator comparisons forcontains: the resultantwhileloop preventsmp_binary_opfrom being inlined in a trace. This commit breaks out the arbitrary-lengthwhileloop into a separate function: normal binary operations are now inlined, but list (etc.) comparisons aren't. The one exception is tuples: those are inlined (and therefore unrolled), because they are almost always small and fixed in size.This speeds nearly everything up, if only by a bit: