-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Rewrite Array#each in Ruby #6687
Conversation
be9f901
to
e291e4f
Compare
2aff775
to
8cfa04c
Compare
8cfa04c
to
6cd0535
Compare
ed56476
to
bf8d9a3
Compare
3f20afb
to
224c1f2
Compare
4b3a2a4
to
5f8ff7b
Compare
5f8ff7b
to
18c9a45
Compare
Given https://bugs.ruby-lang.org/issues/20182#note-5, #9533 will take this over. |
@@ -373,7 +373,7 @@ def add_ivars | |||
|
|||
Fiber.new { | |||
$ary = OBJ_COUNT.times.map { Foo.new } | |||
$ary.each(&:add_ivars) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@k0kubun forgive me my ignorance, but just out of curiosity: why is there a change in tests from each
to reverse_each
?.. If this PR is a refactoring of internal mechanism, shouldn't tests remain the same, to ensure (non-)regression integrity?..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change of this line was actually not necessary, so I reverted it in the end #9533 (comment).
Similarly to
Integer#times
#8388, this PR rewritesArray#each
in Ruby.microbenchmark
Interpreter
It's a bit slower than the original C method.
YJIT
It's 5.3x faster.