summaryrefslogtreecommitdiff
path: root/include/ruby
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2022-07-20 14:06:28 -0700
committerJeremy Evans <code@jeremyevans.net>2022-08-09 22:19:46 -0700
commitfc4b4f2e8db3d68b80b9c7580c40a0165736006c (patch)
tree7004516463d341a5cb5795e43eaf4a0894d57d5c /include/ruby
parent7922fd65e30fb9f011b939dead38cda94a7e2721 (diff)
Expand newarray/expandarray optimization for unequal operands
This optimizes unbalanced multiple assignment cases such as: ```ruby a.b, c.d = e, f, g a.b, c.d, e.f = g, h ``` Previously, this would use: ``` newarray(3) expandarray(2, 0) newarray(2) expandarray(3, 0) ``` These would both allocate arrays. This switches to opt_reverse with either pop or putnil: ``` pop opt_reverse(2) putnil opt_reverse(3) ``` This avoids an unnecessary array allocation, and results in a 35-76% performance increase in these types of unbalanced cases (tested with benchmark/masgn.yml).
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6158
Diffstat (limited to 'include/ruby')
0 files changed, 0 insertions, 0 deletions