Also optimize creation of RegExpMatch result for "str.match"

RESOLVED FIXED in Firefox 44

Status

()

RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: h4writer, Assigned: h4writer)

Tracking

unspecified
mozilla44
Points:
---

Firefox Tracking Flags

(firefox44 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
In bug 879402 this was done for regular regexp matching. But I forgot to do this for string matching.

n = 0;
s = ('hello, world;'); let r = 'hello';
for (var i=0; i<1000000; i++) {
    n+= s.match(r).length;
}

print(n)

Takes 800ms, while with this patch 200ms.
(Assignee)

Comment 1

3 years ago
Created attachment 8665361 [details] [diff] [review]
Patch
Assignee: nobody → hv1989
Attachment #8665361 - Flags: review?(bhackett1024)
(Assignee)

Comment 2

3 years ago
@arai: fyi, this will increase the old performance of "String.prototype.match(string)", without improving the performance of the selfhosted version. Your new code also removes this code, which isn't that bad. But I would like to make sure the selfhosted version is compared with the performance with this patch included. Still looking at potential improvements to get the selfhosted version at the same performance.
Attachment #8665361 - Flags: review?(bhackett1024) → review+
https://hg.mozilla.org/mozilla-central/rev/54e7351f2a6a
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox44: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.