Improve RegExpSearcher and use it in more cases
Categories
(Core :: JavaScript Engine, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox118 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [sp3])
Attachments
(5 files)
RegExpSearcher
is a more optimized version of RegExpMatcher
: it returns the match index and length as a single int32 value and this is nice for places where we don't need to allocate a match object. Because it packs two integers in an int32 value, we can't use it for longer strings, resulting either in more self-hosted code or in places where we just use RegExpMatcher
instead.
A while ago I wrote some patches to change RegExpSearcher
to return only the match index, and store the length separately in the JSContext
where another intrinsic can get it from. This lets us simplify some regexp builtins where we can now use RegExpSearcher
in more cases, and it also lets us switch some callers of RegExpMatcher
to RegExpSearcher
.
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Assignee | ||
Comment 1•1 year ago
|
||
Change the interface so that instead of packing the match index and limit in a
single int32 value, we now only return the index and store the match limit in a
field on the context where we can load it from with a separate intrinsic.
This lets us simplify RegExpReplace
because we don't need separate functions
for short and long strings.
Assignee | ||
Comment 2•1 year ago
|
||
This eliminates some match result object allocations.
Depends on D181658
Assignee | ||
Comment 3•1 year ago
|
||
Depends on D181659
Assignee | ||
Comment 4•1 year ago
|
||
It's uncommon to use split
with a regular expression that has capturing groups.
In this case we can use RegExpSearcher
to avoid allocating a full result object.
Depends on D181660
Assignee | ||
Comment 5•1 year ago
|
||
Depends on D184815
Comment 7•1 year ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/67c8402938e6
https://hg.mozilla.org/mozilla-central/rev/4ffda9b4f4cd
https://hg.mozilla.org/mozilla-central/rev/3e05476949f1
https://hg.mozilla.org/mozilla-central/rev/d2b9dcdf5a9b
https://hg.mozilla.org/mozilla-central/rev/c028aea4532a
Comment 8•1 year ago
•
|
||
Improvements:
8% on Sunspider-regexp-dna
10.5% on Sunspider-string-tagcloud
8% on Sunspider-string-validate-input
tentative 1% overall on Jetstream2 which looks to be driven by :
10% on tagcloud-SP-Average ,4% on regex-dna-SP-Average , 11% on regex-dna-SP-First , 6% on regex-dna-SP-Geometric
Speedometer2:
5% on BackboneJS-TodoMVC
Other probable small improvements in more Speedometer2 sub-tests
Comment 9•1 year ago
|
||
(In reply to Pulsebot from comment #6)
Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/67c8402938e6
part 1 - Change RegExpSearcher interface so it can be used for longer
strings. r=iain
https://hg.mozilla.org/integration/autoland/rev/4ffda9b4f4cd
part 2 - Use RegExpSearcher in RegExpGlobalMatchOpt and RegExpSplit. r=iain
https://hg.mozilla.org/integration/autoland/rev/3e05476949f1
part 3 - Optimize RegExpSearcherLastLimit in the JITs. r=iain
https://hg.mozilla.org/integration/autoland/rev/d2b9dcdf5a9b
part 4 - Add RegExpSearcher fast path to RegExpSplit. r=iain
https://hg.mozilla.org/integration/autoland/rev/c028aea4532a
part 5 - Optimize RegExpHasCaptureGroups intrinsic in the JITs. r=iain
== Change summary for alert #39208 (as of Thu, 03 Aug 2023 08:30:52 GMT) ==
Improvements:
Ratio | Test | Platform | Options | Absolute values (old vs new) | Performance Profiles |
---|---|---|---|---|---|
13% | google-mail LastVisualChange | macosx1015-64-shippable-qr | cold fission webrender | 1,534.24 -> 1,337.36 | Before/After |
For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=39208
Description
•