Title: [183874] trunk/Source/_javascript_Core
Revision
183874
Author
[email protected]
Date
2015-05-06 10:10:38 -0700 (Wed, 06 May 2015)

Log Message

Don't allocate a StringImpl for every Number JSValue in JSON.stringify().
<https://webkit.org/b/144676>

Reviewed by Darin Adler.

We were creating a new String for every number JSValue passing through the JSON stringifier.
These StringImpl allocations were dominating one of the Kraken JSON benchmarks.
Optimize this by using StringBuilder::appendECMAScriptNumber() which uses a stack buffer
for the conversion instead.

13% progression on Kraken/json-stringify-tinderbox.

* runtime/JSONObject.cpp:
(JSC::Stringifier::appendStringifiedValue):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (183873 => 183874)


--- trunk/Source/_javascript_Core/ChangeLog	2015-05-06 17:02:47 UTC (rev 183873)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-05-06 17:10:38 UTC (rev 183874)
@@ -1,3 +1,20 @@
+2015-05-06  Andreas Kling  <[email protected]>
+
+        Don't allocate a StringImpl for every Number JSValue in JSON.stringify().
+        <https://webkit.org/b/144676>
+
+        Reviewed by Darin Adler.
+
+        We were creating a new String for every number JSValue passing through the JSON stringifier.
+        These StringImpl allocations were dominating one of the Kraken JSON benchmarks.
+        Optimize this by using StringBuilder::appendECMAScriptNumber() which uses a stack buffer
+        for the conversion instead.
+
+        13% progression on Kraken/json-stringify-tinderbox.
+
+        * runtime/JSONObject.cpp:
+        (JSC::Stringifier::appendStringifiedValue):
+
 2015-05-06  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r183847.

Modified: trunk/Source/_javascript_Core/runtime/JSONObject.cpp (183873 => 183874)


--- trunk/Source/_javascript_Core/runtime/JSONObject.cpp	2015-05-06 17:02:47 UTC (rev 183873)
+++ trunk/Source/_javascript_Core/runtime/JSONObject.cpp	2015-05-06 17:10:38 UTC (rev 183874)
@@ -394,7 +394,7 @@
         if (!std::isfinite(number))
             builder.appendLiteral("null");
         else
-            builder.append(String::numberToStringECMAScript(number));
+            builder.appendECMAScriptNumber(number);
         return StringifySucceeded;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to