[Webkit-unassigned] [Bug 30436] fast/css/large-list-of-rules-crash.html concatenates strings in an inefficient way

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Oct 17 22:57:45 PDT 2009


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





--- Comment #5 from Yuta Kitamura <yutak at chromium.org>  2009-10-17 22:57:45 PDT ---
(In reply to comment #4)
> It’d be stronger if you took a few seconds to provide data to support your
> claim that it is inefficient.

Original code look like this:
    var s = "";
    for (i = 0 ; i < 200000 ; i++) {
        s += "a {}\n";
    }

This code produces potentially (especially for debug binary) allocation of
200000 string objects with length of 5, 10, 15, ..., 5*200000. The fixed
version does not require the intermediate string objects.

I believe using Array.join is the common pattern to avoid unneeded allocation.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list