Inline String.prototype.endsWith with constant search strings
Categories
(Core :: JavaScript Engine: JIT, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox105 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
Details
Attachments
(5 files)
Like bug 1782959, except for endsWith
instead of startsWith
.
Real world use case:
This saves a couple of thousand VM calls to endsWith
per second when watching videos on reddit.
Additionally also fold str.indexOf(searchStr) == 0
to str.startsWith(searchStr)
, because I saw some sites benefiting from this optimisation.
Assignee | ||
Comment 1•2 years ago
|
||
Adding a comma after JS_FS_END
ensures clang-format will add each entry on a
separate line.
Assignee | ||
Comment 2•2 years ago
|
||
For now simply call into the VM. Part 3 will add an optimisation when the
search string is a constant.
Depends on D154210
Assignee | ||
Comment 3•2 years ago
|
||
This is similar to the optimisation for String.prototype.startsWith
.
Depends on D154211
Assignee | ||
Comment 4•2 years ago
|
||
The next part will try to optimise indexOf()
when it can be folded to
startsWith()
.
Depends on D154212
Assignee | ||
Comment 5•2 years ago
|
||
Depends on D154213
Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/c4538d007f20 Part 1: Add comma after JS_FS_END for nicer formatting. r=jandem https://hg.mozilla.org/integration/autoland/rev/c28f80a3d291 Part 2: Inline String.prototype.endsWith. r=jandem https://hg.mozilla.org/integration/autoland/rev/22bd3cd5785d Part 3: Inline String.prototype.endsWith with a constant search string. r=jandem https://hg.mozilla.org/integration/autoland/rev/242adcdcf927 Part 4: Inline String.prototype.indexOf() with a VM-call. r=jandem https://hg.mozilla.org/integration/autoland/rev/53f620bb8261 Part 5: Fold MStringIndexOf to MStringStartsWith. r=jandem
Comment 7•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c4538d007f20
https://hg.mozilla.org/mozilla-central/rev/c28f80a3d291
https://hg.mozilla.org/mozilla-central/rev/22bd3cd5785d
https://hg.mozilla.org/mozilla-central/rev/242adcdcf927
https://hg.mozilla.org/mozilla-central/rev/53f620bb8261
Description
•