Closed Bug 509826 Opened 15 years ago Closed 15 years ago

replace js_NewStringCopyN uses with js_NewDependentString in jstr

Categories

(Core :: JavaScript Engine, defect)

ARM
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.2 --- beta1-fixed

People

(Reporter: luke, Assigned: luke)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
In find_replen and match_glob.

This resulted in a 2-3% speedup in string-unpack-code.

The patch also does a tiny bit o' cleanup.
Attachment #393890 - Flags: review?(jwalden+bmo)
Summary: replace js_NewStringCopyN uses with js_NewDependentString → replace js_NewStringCopyN uses with js_NewDependentString in jstr
And for this micro-benchmark, 27% faster:

var d = new Date();
var a;
for (var i = 0; i < 200000; ++i) {
    a = "aabbccddaabbccddaabbccdd".replace(/(a+)(b+)(c+)(d+)/g, function(){return "."});
}
print(new Date() - d);
Attachment #393890 - Attachment is obsolete: true
Attachment #394175 - Flags: review?(jwalden+bmo)
Attachment #393890 - Flags: review?(jwalden+bmo)
review ping
Comment on attachment 394175 [details] [diff] [review]
overly strong assertion, forgot about empty matches

>diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp

>+        for (uintN j = 0; i < n; i++, j++) {
>+            if (!PushRegExpSubstr(cx, cx->regExpStatics.parens[j], sp))
>+                goto lambda_out;
>+        }
>+        for (uintN j = 0; i < m; i++, j++) {
>+            if (!PushRegExpSubstr(cx, cx->regExpStatics.moreParens[j], sp))
>+                goto lambda_out;
>+        }

I will assume we have dropped any compilers which hate "redeclaring" uintN j.  Ware tinderbox bustage.
Attachment #394175 - Flags: review?(jwalden+bmo) → review+
http://hg.mozilla.org/mozilla-central/rev/c857e77e6f01
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: