Bug 204481 - Optimize String.prototype.replace() and replaceAll() for string searches.
Summary: Optimize String.prototype.replace() and replaceAll() for string searches.
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords:
Depends on: 204479
Blocks:
  Show dependency treegraph
 
Reported: 2019-11-21 16:40 PST by Mark Lam
Modified: 2019-11-22 09:30 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2019-11-21 16:40:25 PST
...
Comment 1 Mark Lam 2019-11-21 17:55:13 PST
I created 3 microbenchmarks based on string-replace.js, string-replace-generic.js, and string-replace-empty.js, but use "f" as the searchValue instead of /f/g.  With these, I see that the patch in https://bugs.webkit.org/show_bug.cgi?id=202471 did indeed regressed performance:

                                               Old                       New
string-replace-generic-2                       30.0312+-1.2393     !     34.9829+-1.4384        ! definitely 1.1649x slower
string-replace-2                               29.4600+-1.1706     !     33.9296+-2.0799        ! definitely 1.1517x slower
string-replace-empty-2                         20.7875+-0.4358     !     24.9824+-1.1148        ! definitely 1.2018x slower