[Webkit-unassigned] [Bug 155146] New: Array destructuring is very slow

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 7 16:09:49 PST 2016


https://bugs.webkit.org/show_bug.cgi?id=155146

            Bug ID: 155146
           Summary: Array destructuring is very slow
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: joepeck at webkit.org
                CC: fpizlo at apple.com, ggaren at apple.com,
                    keith_miller at apple.com, sbarati at apple.com,
                    utatane.tea at gmail.com

Created attachment 273235
  --> https://bugs.webkit.org/attachment.cgi?id=273235&action=review
[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);

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160308/68c83f5a/attachment.html>


More information about the webkit-unassigned mailing list