Skip to content
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

YJIT: Add codegen for Array#<< #7645

Merged
merged 1 commit into from Apr 3, 2023
Merged

Conversation

k0kubun
Copy link
Member

@k0kubun k0kubun commented Apr 3, 2023

This codegen simply skips pushing a frame when calling Array#<<. The interpreter skips it on opt_ltlt, so it's fair to do the same thing on YJIT.

Note that we cannot use Primitive.attr! :leaf to implement this because BOP methods must be implemented in C at the moment.

Benchmark

I found this is useful for speeding up Optcarrot when I worked on RJIT. This doesn't speed up headline benchmarks, but this method should be fairly popular in actual real-world applications.

before: ruby 3.3.0dev (2023-04-03T15:59:05Z master ba4ff2552e) +YJIT [x86_64-linux]
after: ruby 3.3.0dev (2023-04-03T18:20:37Z yjit-array-push cbf04e0aad) +YJIT [x86_64-linux]

---------  -----------  ----------  ----------  ----------  ------------  -------------
bench      before (ms)  stddev (%)  after (ms)  stddev (%)  before/after  after 1st itr
optcarrot  1823.1       0.8         1757.6      0.7         1.04          1.05
---------  -----------  ----------  ----------  ----------  ------------  -------------

@matzbot matzbot requested a review from a team April 3, 2023 18:31
Copy link
Contributor

@maximecb maximecb left a comment

Choose a reason for hiding this comment

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

Nice :)

@maximecb
Copy link
Contributor

maximecb commented Apr 3, 2023

GitHub CI is broken for some reason. Seems unrelated to this PR.

@k0kubun k0kubun merged commit 38209ff into ruby:master Apr 3, 2023
99 checks passed
@k0kubun k0kubun deleted the yjit-array-push branch April 3, 2023 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants