Add a fast path for atom regexps in PrepareAndExecuteRegExp
Categories
(Core :: JavaScript Engine: JIT, enhancement, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox79 | --- | fixed |
People
(Reporter: iain, Assigned: iain)
References
Details
Attachments
(1 file)
If a regexp pattern is just a single atom (like /foo/
), we can use a normal string search instead of compiling regexp code. However, the Ion stubs for RegExpMatcher/Searcher/Tester don't handle atom regexps directly; instead, they fall back to an OOL VM call. This makes atom matching significantly slower than regexp matching.
It's pretty easy to check for atom regexps in PrepareAndExecuteRegExp, and call the string search code directly. Microbenchmarking on my machine, this is about twice as fast as the old approach, and basically the same speed as a comparable regexp (at a fraction of the memory usage, since we only need to store the pattern atom).
Assignee | ||
Comment 1•4 years ago
|
||
We fill in the match pairs for atom regexps using an ABI call, then use the normal jit path for everything else (checking for errors, allocating results, etc...).
I also made a drive-by fix to remove the cx argument from RegExpShared::executeAtom, since we don't need it.
Updated•4 years ago
|
Pushed by iireland@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ade4376497cf Add fast path for atom regexps r=jandem
Comment 3•4 years ago
|
||
bugherder |
Description
•