Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2ec81a993d3545b50fad8cca19ea0cb5d021df18
      
https://github.com/WebKit/WebKit/commit/2ec81a993d3545b50fad8cca19ea0cb5d021df18
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-04-13 (Mon, 13 Apr 2026)

  Changed paths:
    A JSTests/microbenchmarks/json-stringify-int32-array.js
    M Source/JavaScriptCore/runtime/JSONObject.cpp

  Log Message:
  -----------
  [JSC] Add Int32 array fast path to `FastStringifier` for `JSON.stringify`
https://bugs.webkit.org/show_bug.cgi?id=311911

Reviewed by Yusuke Suzuki.

For Int32-shaped arrays, FastStringifier currently calls canGetIndexQuickly +
getIndexQuickly per element (each switching on indexingType()) and then
re-enters the recursive append(JSValue) type-dispatch chain.

Add a NEVER_INLINE appendInt32Array() that walks the contiguousInt32 butterfly
directly and emits each element via std::to_chars. The Int32 emission body is
factored into ALWAYS_INLINE appendInt32() shared with the existing isInt32()
case.

                                              Before                   Patched

json-stringify-int32-array               61.2083+-0.5523     ^     
19.8872+-0.1330        ^ definitely 3.0778x faster
json-stringify-empty-array               20.7855+-0.5127           
20.7303+-0.1234
vanilla-todomvc-json-stringify           48.5458+-0.4959     ^     
47.1891+-0.4344        ^ definitely 1.0288x faster

<geometric>                              48.9427+-0.2815     ^     
40.2815+-0.1213        ^ definitely 1.2150x faster

Test: JSTests/microbenchmarks/json-stringify-int32-array.js

* JSTests/microbenchmarks/json-stringify-int32-array.js: Added.
* Source/JavaScriptCore/runtime/JSONObject.cpp:
(JSC::bufferMode>::appendInt32):
(JSC::bufferMode>::append):
(JSC::bufferMode>::appendInt32Array):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to