You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf: interpreter block invocation from native iterators #382
Array#each, #map and #any? over 10 elements (ns per whole call):
each
map
any?
rubyrs interp
3143
3216
3247
rubyrs tier-2
363
425
403
CRuby 3.4
232
284
251
That is about 290 ns per element in the interpreter, versus about 36 ns under tier-2. The tier-2 path already has a cheap way to call a block from a native iterator. The interpreter does not use it.
This is the largest single interpreter gap: Rails runs 223 block calls per request, and about 40 of them come from Array#each alone.
Do:
Profile the interpreter path.
Port the tier-2 native-iterator → block call path (or its essence: frame reuse across iterations, no per-yield re-dispatch) to the interpreter, for Array/Hash/Range/Integer iterators first.
Done when:
Interpreter each(10) costs ≤ 2× CRuby.
No diff_cruby regressions, especially break/next/redo/return-from-block and ensure fixtures.
Activity
Merge pull request #397 from linyiru/perf/interp-block-invoke