Project

General

Profile

« Previous | Next » 

Revision fc4b4f2e

Added by jeremyevans (Jeremy Evans) almost 3 years ago

Expand newarray/expandarray optimization for unequal operands

This optimizes unbalanced multiple assignment cases such as:

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).