Array destructuring is slow
Categories
(Core :: JavaScript Engine: JIT, enhancement, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox120 | --- | fixed |
People
(Reporter: alexical, Assigned: alexical)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [sp3])
Attachments
(1 file, 1 obsolete file)
Array destructuring currently follows the iterator protocol, which is unnecessarily slow. We should add a fast path in bytecode as a first step.
Updated•2 years ago
|
| Assignee | ||
Comment 1•2 years ago
|
||
This is I think the simplest possible approach. This patch basically just
mirrors the OptimizeSpreadCall optimization, but for array destructuring.
We did add one constraint which has effects outside of this, which is that
the array iterator prototype can't have a return method defined. I think in
practice only very weird code should have this set, but we can be more
targeted if this is a real issue.
Updated•2 years ago
|
| Assignee | ||
Comment 2•2 years ago
|
||
This was the simplest way I could come up with to accomplish this, but please
let me know if there's a better way. The earlier patch in the stack adds an
optimized path when doing array destructuring, but I missed a test failure in
a case like (() => let y = [y] = [,])(). This case takes the unoptimized
path at runtime, but still emits the optimized path. Since we emit the
optimized path first, we update the TDZ cache telling it to not emit it again
for y, which leads us to skip the check for the unoptimized path.
Depends on D184843
Updated•2 years ago
|
Comment 4•2 years ago
|
||
| bugherder | ||
Description
•