[webkit-changes] [WebKit/WebKit] 3fa658: [JSC] Optimize JSON.stringify integer serialization

Yusuke Suzuki noreply at github.com
Sat May 6 14:25:05 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3fa658700239c8e7cbe8fa20793a6314274560cd
      https://github.com/WebKit/WebKit/commit/3fa658700239c8e7cbe8fa20793a6314274560cd
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-05-06 (Sat, 06 May 2023)

  Changed paths:
    A JSTests/stress/json-stringify-integer.js
    M Source/JavaScriptCore/runtime/JSONObject.cpp

  Log Message:
  -----------
  [JSC] Optimize JSON.stringify integer serialization
https://bugs.webkit.org/show_bug.cgi?id=256409
rdar://108978640

Reviewed by Darin Adler.

Let's use std::to_chars. The current implementation is extremely optimized, and faster than our custom implementation.
Right now, we are not switching to std::to_chars for everything since there is an impedance mismatch in our API and this function,
but we can just use it for FastStringifier. We also optimized forEachProperty code to just use `auto` of parameter, which
continues using CompactPropertyTableEntry for CompactPRopertyTable (majority of objects).

                                               ToT                     Patched

    vanilla-todomvc-json-stringify       52.0172+-0.3011     ^     46.4912+-0.2382        ^ definitely 1.1189x faster

* JSTests/stress/json-stringify-integer.js: Added.
(shouldBe):
* Source/JavaScriptCore/runtime/JSONObject.cpp:
(JSC::Stringifier::Holder::appendNextProperty):
(JSC::FastStringifier::append):

Canonical link: https://commits.webkit.org/263765@main




More information about the webkit-changes mailing list