Bug 144676 - Don't allocate a StringImpl for every Number JSValue in JSON.stringify().
Summary: Don't allocate a StringImpl for every Number JSValue in JSON.stringify().
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
Keywords: Performance
Depends on:
Reported: 2015-05-06 00:53 PDT by Andreas Kling
Modified: 2015-05-06 10:12 PDT (History)
5 users (show)

See Also:

Patch (1.90 KB, patch)
2015-05-06 00:54 PDT, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (1.88 KB, patch)
2015-05-06 01:39 PDT, Andreas Kling
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2015-05-06 00:53:46 PDT
We can do a lot better on Kraken/json-stringify-tinderbox!

For example:
json-stringify-tinderbox        63.370+-3.319      ^      56.031+-3.150         ^ definitely 1.1310x faster
Comment 1 Andreas Kling 2015-05-06 00:54:46 PDT
Created attachment 252461 [details]
Comment 2 WebKit Commit Bot 2015-05-06 00:56:32 PDT
Attachment 252461 [details] did not pass style-queue:

ERROR: Source/JavaScriptCore/runtime/JSONObject.cpp:41:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 1 in 2 files

If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Andreas Kling 2015-05-06 01:39:05 PDT
Created attachment 252462 [details]
Comment 4 Darin Adler 2015-05-06 09:23:09 PDT
Comment on attachment 252462 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=252462&action=review

> Source/JavaScriptCore/runtime/JSONObject.cpp:399
> +            NumberToStringBuffer buffer;
> +            builder.append(numberToString(number, buffer));

StringBuilder has a function named appendECMAScriptNumber. I suggest you use that instead, which would make your patch even smaller.
Comment 5 Andreas Kling 2015-05-06 10:12:05 PDT
Committed r183874: <http://trac.webkit.org/changeset/183874>