<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Array destructuring is very slow"
href="https://bugs.webkit.org/show_bug.cgi?id=155146">155146</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Array destructuring is very slow
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>WebKit Nightly Build
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>OS</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>JavaScriptCore
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>joepeck@webkit.org
</td>
</tr>
<tr>
<th>CC</th>
<td>fpizlo@apple.com, ggaren@apple.com, keith_miller@apple.com, sbarati@apple.com, utatane.tea@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=273235" name="attach_273235" title="[TEST] Array Destructuring Benchmark">attachment 273235</a> <a href="attachment.cgi?id=273235&action=edit" title="[TEST] Array Destructuring Benchmark">[details]</a></span>
[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);</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>