Skip to content

Conversation

@maximecb
Copy link
Contributor

@maximecb maximecb commented Dec 3, 2024

This is a modified version of a microbenchmark circulated on twitter by "TheDumbTechGuy". It's obviously not representative of most Ruby code, but it does show areas where we could perform much better with better inlining and better quality code generation.

This is a modified version of a microbenchmark circulated on
twitter by "TheDumbTechGuy". It's obviously not representative of
most Ruby code, but it does show areas where we could perform
much better with better inlining and better quality code
generation.
@maximecb maximecb enabled auto-merge (squash) December 3, 2024 21:10
@maximecb maximecb merged commit 1dbbdce into main Dec 3, 2024
4 checks passed
@maximecb maximecb deleted the loop_bench branch December 3, 2024 21:20

4_000.times do |i|
4_000.times do |j|
a[i] += j % u
Copy link
Member

@eregon eregon Dec 4, 2024

Choose a reason for hiding this comment

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

This modulo in the inner loop likely dominates the benchmark, I'd suggest to use & 0b111 or so instead.

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.

4 participants