8000 YJIT: Specialize Integer#pred by k0kubun · Pull Request #12082 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

YJIT: Specialize Integer#pred #12082

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

Merged
merged 1 commit into from
Nov 14, 2024
Merged

YJIT: Specialize Integer#pred #12082

merged 1 commit into from
Nov 14, 2024

Conversation

k0kubun
Copy link
Member
@k0kubun k0kubun commented Nov 13, 2024

This PR adds specialized codegen for Integer#pred. Since chunky-png uses Integer#downto a lot, #12074 made Integer#pred the most frequently called method in that benchmark.

Top-20 most frequent C calls (20.8% of C calls):
  3,355,140 (20.5%): Integer#pred
     16,171 ( 0.1%): Array#slice
      8,971 ( 0.1%): Enumerable#each_slice
      3,729 ( 0.0%): Integer#to_s
      3,600 ( 0.0%): String#*
...

Adding this specialization speeds up chunky-png a little.

before: ruby 3.4.0dev (2024-11-13T21:17:29Z master 30e1d6b5a8) +YJIT +PRISM [x86_64-linux]
after: ruby 3.4.0dev (2024-11-13T23:40:22Z yjit-pred 17c6d54fb2) +YJIT +PRISM [x86_64-linux]

----------  -----------  ----------  ----------  ----------  -------------  ------------
bench       before (ms)  stddev (%)  after (ms)  stddev (%)  after 1st itr  before/after
chunky-png  254.8        0.3         247.7       0.3         1.02           1.03
----------  -----------  ----------  ----------  ----------  -------------  ------------

@matzbot matzbot requested a review from a team November 13, 2024 23:42
@maximecb maximecb merged commit 7e2f9ea into ruby:master Nov 14, 2024
70 checks passed
@k0kubun k0kubun deleted the yjit-pred branch November 14, 2024 18:17
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.

2 participants
0