WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 169030
155146
Array destructuring is very slow
https://bugs.webkit.org/show_bug.cgi?id=155146
Summary
Array destructuring is very slow
Joseph Pecoraro
Reported
2016-03-07 16:09:49 PST
Created
attachment 273235
[details]
[TEST] Array Destructuring Benchmark * SUMMARY Array destructuring is very slow. There is a 20x performance difference between using destructuring with Arrays versus not. Object destructuring does not seem to have this cost. [Log] Array - Normal - 2ms [Log] Array - Destructuring - 48ms [Log] Object - Normal - 2ms [Log] Object - Destructuring - 1ms * TEST (full test attached) bench("Array - Normal", function(arr) { var sum = 0; for (var i = 0; i < arr.length; ++i) { var list = arr[i]; var a = list[0], b = list[1], c = list[2], d = list[3], e = list[4]; sum += (a + b + c + d + e); } return sum; }, listOfLists); bench("Array - Destructuring", function(arr) { var sum = 0; for (var i = 0; i < arr.length; ++i) { var [a, b, c, d, e] = arr[i]; sum += (a + b + c + d + e); } return sum; }, listOfLists);
Attachments
[TEST] Array Destructuring Benchmark
(1.64 KB, text/html)
2016-03-07 16:09 PST
,
Joseph Pecoraro
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Joseph Pecoraro
Comment 1
2017-03-06 13:29:54 PST
In Safari Technology Preview array destructuring has improved greatly! However it is still considerably slower than normal array access: (~7x down from ~20x). [Log] Array - Normal - 2ms [Log] Array - Destructuring - 15ms [Log] Object - Normal - 1ms [Log] Object - Destructuring - 1ms
Saam Barati
Comment 2
2017-03-07 10:42:04 PST
(In reply to
comment #1
)
> In Safari Technology Preview array destructuring has improved greatly! > However it is still considerably slower than normal array access: (~7x down > from ~20x). > > [Log] Array - Normal - 2ms > [Log] Array - Destructuring - 15ms > [Log] Object - Normal - 1ms > [Log] Object - Destructuring - 1ms
I think we really need more comprehensive support for making the iterator protocol fast. Whatever we do to make for-of faster, should also make this faster.
Saam Barati
Comment 3
2017-03-07 10:43:07 PST
*** This bug has been marked as a duplicate of
bug 169030
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug