Bug 204481
| Summary: | Optimize String.prototype.replace() and replaceAll() for string searches. | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Mark Lam <mark.lam> |
| Component: | JavaScriptCore | Assignee: | Mark Lam <mark.lam> |
| Status: | ASSIGNED | ||
| Severity: | Normal | CC: | ross.kirsling |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Bug Depends on: | 204479 | ||
| Bug Blocks: | |||
Mark Lam
...
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Mark Lam
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