Skip to content

Multiple assignment has too much overhead #2916

@headius

Description

@headius

Multiple assignment has taken a perf hit in 9k compared to 1.7, and there's other opportunities to go beyond 1.7.

The main issue is that it's always producing the RHS array for some forms, and simply not eliminating it for other forms.

This case should optimize to simple moves. I believe it doesn't because DCE is not running:

a, b, c = d, e, f

This case, where ary is already an array, should not have to dup the array. I believe we dup it now preemptively because it may be used as the return value of the expression. However this won't go away with DCE because ary is opaque (assume it's opaque below).

ary = [1,2,3]
...
a, b, c = *ary

These cases affect performance on e.g. https://github.com/YorickPeterse/oga because it uses masgn in the second way above. Many other libraries use these forms too.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions