Closed
Bug 1398226
Opened 7 years ago
Closed 7 years ago
Remove the indirection through NewDependentString in StaticStrings::getUnitStringForElement
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla57
Tracking | Status | |
---|---|---|
firefox57 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
Details
Attachments
(1 file)
2.01 KB,
patch
|
jandem
:
review+
|
Details | Diff | Splinter Review |
It shaves a couple of milliseconds if we remove the extra indirection through NewDependentString.
Assignee | ||
Comment 1•7 years ago
|
||
Directly calling NewInlineString avoids the second static-strings lookup in [1], and because we know that JSDependentString::new_ [2] will always create an inline string for one-element strings, we can directly call NewInlineString. We also know that result string is definitely a two-byte string, because the UNIT_STATIC_LIMIT check in [3] failed. I've also changed str_enumerate to use StaticStrings::getUnitStringForElement(...) for consistency with str_resolve [4]. [1] http://searchfox.org/mozilla-central/rev/44c693914255638d74bcf1ec3b0bcd448dfab2fd/js/src/vm/String.cpp#1147-1157 [2] http://searchfox.org/mozilla-central/rev/44c693914255638d74bcf1ec3b0bcd448dfab2fd/js/src/vm/String-inl.h#171-184 [3] http://searchfox.org/mozilla-central/rev/44c693914255638d74bcf1ec3b0bcd448dfab2fd/js/src/vm/String-inl.h#349 [4] http://searchfox.org/mozilla-central/rev/44c693914255638d74bcf1ec3b0bcd448dfab2fd/js/src/jsstr.cpp#558
Attachment #8906030 -
Flags: review?(jdemooij)
Assignee | ||
Comment 2•7 years ago
|
||
Improves this µ-benchmark from ~410-430ms to ~360-380ms for me: var s = "Ā".repeat(50); // Ā is U+0100 (LATIN CAPITAL LETTER A WITH MACRON) var q = 0; var t = dateNow(); for (var i = 0; i < 100000; ++i) { q += s.split("").length; } print(dateNow() - t);
Comment 3•7 years ago
|
||
Comment on attachment 8906030 [details] [diff] [review] bug1398226.patch Review of attachment 8906030 [details] [diff] [review]: ----------------------------------------------------------------- Nice
Attachment #8906030 -
Flags: review?(jdemooij) → review+
Assignee | ||
Comment 4•7 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=c81871eea186ad47a320f979b186ca6b7a7d9325
Keywords: checkin-needed
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/cdaed5454569 Remove the indirection through NewDependentString when creating inline-strings in StaticStrings::getUnitStringForElement. r=jandem
Keywords: checkin-needed
Comment 6•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/cdaed5454569
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in
before you can comment on or make changes to this bug.
Description
•