Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3e2d78bf8226127c6f7c9766579f95a5499814b5
      
https://github.com/WebKit/WebKit/commit/3e2d78bf8226127c6f7c9766579f95a5499814b5
  Author: Sosuke Suzuki <aosuk...@gmail.com>
  Date:   2024-07-15 (Mon, 15 Jul 2024)

  Changed paths:
    A JSTests/microbenchmarks/string-replaceall-benchmark.js
    M Source/JavaScriptCore/runtime/StringPrototypeInlines.h

  Log Message:
  -----------
  [JSC] Add fast path for `String#replaceAll`
https://bugs.webkit.org/show_bug.cgi?id=275310

Reviewed by Yusuke Suzuki.

`String#replace(search, replace)` already has a fast path when `search` and 
`replace` are Strings,
but `String#replaceAll` does not.

This patch adds a fast path to `String#replaceAll` using almost the same 
algorithm as the fast path
for `String#replace`. A microbenchmark shows an improvement of about 1.3x ~ 
1.4x:

                                     TipOfTree                  Patched

string-replaceall-benchmark      413.9061+-13.2920    ^    304.0226+-4.1146     
   ^ definitely 1.3614x faster

* JSTests/microbenchmarks/string-replaceall-benchmark.js: Added.
(fill):
(test.template.li.data.id.string_appeared_here.div.input):
(test.template.li.data.id.string_appeared_here.div):
(test.label.button.button.div.li.li.data.id.string_appeared_here.div.input):
(test.label.button.button.div.li.li.data.id.string_appeared_here.div):
(test.label.button):
* Source/JavaScriptCore/runtime/StringPrototypeInlines.h:
(JSC::stringReplaceAllStringString):
(JSC::replaceUsingStringSearch):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to