Changeset 76635 in webkit


Ignore:
Timestamp:
Jan 25, 2011 1:13:55 PM (13 years ago)
Author:
oliver@apple.com
Message:

2011-01-25 Oliver Hunt <oliver@apple.com>

Reviewed by Gavin Barraclough.

JSON.stringify processing time exponentially grows with size of object
https://bugs.webkit.org/show_bug.cgi?id=51922

Remove last use of reserveCapacity from JSON stringification, as it results
in appalling append behaviour when there are a large number of property names
and nothing else.

  • runtime/JSONObject.cpp: (JSC::Stringifier::appendQuotedString):
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r76615 r76635  
     12011-01-25  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        JSON.stringify processing time exponentially grows with size of object
     6        https://bugs.webkit.org/show_bug.cgi?id=51922
     7
     8        Remove last use of reserveCapacity from JSON stringification, as it results
     9        in appalling append behaviour when there are a large number of property names
     10        and nothing else.
     11
     12        * runtime/JSONObject.cpp:
     13        (JSC::Stringifier::appendQuotedString):
     14
    1152011-01-25  Antti Koivisto  <antti@apple.com>
    216
  • trunk/Source/JavaScriptCore/runtime/JSONObject.cpp

    r76248 r76635  
    284284{
    285285    int length = value.length();
    286 
    287     // String length plus 2 for quote marks plus 8 so we can accomodate a few escaped characters.
    288     builder.reserveCapacity(builder.length() + length + 2 + 8);
    289286
    290287    builder.append('"');
Note: See TracChangeset for help on using the changeset viewer.