camelCase() is 2.8x faster in V8 than SM
Categories
(Core :: JavaScript Engine: JIT, defect, P3)
Tracking
()
People
(Reporter: jrmuizel, Unassigned)
References
(Depends on 2 open bugs, Blocks 2 open bugs)
Details
(Whiteboard: [sp3])
// Matches dashed string for camelizing
var rmsPrefix = /^-ms-/,
rdashAlpha = /-([a-z])/g;
// Used by camelCase as callback to replace()
function fcamelCase( _all, letter ) {
return letter.toUpperCase();
}
function camelCase( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
}
Making Firefox as fast as Chrome on this function would reduce its time by 1.1% on TodoMVC-Backbone.
camelCase
is called 714 times during TodoMVC-Backbone
. It is called with these strings:
"focusout"
"events"
"display"
The time in the profiles does not include any time spent in fcamelCase
(but there are no matches)
FF: https://share.firefox.dev/47qFM8Z
Chrome: https://share.firefox.dev/49KmQ73
Reporter | ||
Updated•10 months ago
|
Comment 1•10 months ago
|
||
This has both functional (with a JS callback function) and non-functional replace calls.
I tried to rewrite the non-functional case in C++ in bug 1859521. It showed some small improvements on Speedometer 3 and it was definitely faster than the Baseline code we're executing here, but it was slower than the Ion-compiled version.
Here we spend more time in RegExpGlobalReplaceOptFunc
and that will have to stay as self-hosted code because calling into JS is slow from C++. The simplest option for now might be to try to get some of these self-hosted functions into Ion faster.
Comment 2•10 months ago
|
||
RegExpGlobalReplaceOptFunc
gets a maximum warm up count value of ~1482 on Backbone, just short of the Ion threshold.
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
Description
•