Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4d816460b765acd8aef90ab474615850b91ecc35
      
https://github.com/WebKit/WebKit/commit/4d816460b765acd8aef90ab474615850b91ecc35
  Author: Yusuke Suzuki <[email protected]>
  Date:   2023-07-14 (Fri, 14 Jul 2023)

  Changed paths:
    A JSTests/microbenchmarks/rope-resolve-recursive.js
    M Source/JavaScriptCore/runtime/JSString.cpp
    M Source/JavaScriptCore/runtime/JSString.h
    M Source/JavaScriptCore/runtime/JSStringInlines.h
    M Source/WTF/wtf/Compiler.h

  Log Message:
  -----------
  [JSC] Further optimize JSRopeString::resolveRope
https://bugs.webkit.org/show_bug.cgi?id=259203
rdar://112241674

Reviewed by Mark Lam.

This patch furhter improves JSRopeString::resolveRope and jsAtomString.

1. We crafted JSRopeString::resolveToBuffer very carefully so that it becomes 
tail calls well.
   This allows clang to make it loop instead of calls for recursive 
resolveToBuffer calls, which
   is significantly efficient. We ensure this condition is met by using 
MUST_TAIL_CALL C++ attribute,
   which is available in clang.
2. We tweak jsAtomString to make it better in terms of performance. It turned 
out these duplicate part
   is mandatory to make it super efficient, which is observed by JetStream2/WSL.

Simple rope resolution gets 3-4% improvement.

                                   ToT                     Patched

rope-resolve-recursive       21.3292+-0.6975     ^     20.5524+-0.0687        ^ 
definitely 1.0378x faster

* Source/JavaScriptCore/runtime/JSString.cpp:
(JSC::JSRopeString::resolveRopeInternalNoSubstring const):
* Source/JavaScriptCore/runtime/JSString.h:
* Source/JavaScriptCore/runtime/JSStringInlines.h:
(JSC::JSRopeString::resolveToBufferSlow):
(JSC::JSRopeString::resolveToBuffer):
(JSC::jsAtomString):
(JSC::JSStringFibers::JSStringFibers): Deleted.
(JSC::JSStringFibers::fiber const): Deleted.
(JSC::JSStringFibers::fiber0 const): Deleted.
(JSC::JSStringFibers::fiber1 const): Deleted.
(JSC::JSStringFibers::fiber2 const): Deleted.
(): Deleted.
* Source/WTF/wtf/Compiler.h:

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to