Too much time spent in RegExp-related functions on Speedometer (String.prototype.replace, RegExp.prototype.test, String.prototype.match, RegExp.prototype.exec)
Categories
(Core :: JavaScript Engine, defect, P3)
Tracking
()
People
(Reporter: mstange, Assigned: jandem)
References
(Depends on 1 open bug, Blocks 2 open bugs)
Details
(Whiteboard: [sp3])
We see a large difference between Spidermonkey and V8 spent in regular expression related functions on sp3.
Matching V8's String.prototype.replace
performance would gain us 10.4% on Svelte, 4.2% on Preact, and 2.8% on Backbone.
Matching V8's RegExp.prototype.test
performance would gain us 1.6% on Backbone and 1.0% on Vue.
Matching V8's String.prototype.match
performance would gain us 2.1% on Backbone.
Matching V8's RegExp.prototype.exec
performance would gain us 1.3% on Backbone.
Svelte
TodoMVC-Svelte calls String.prototype.replace
from this anonymous function inside instance
.
SM: total 1943
297 replace
: 113 interp + 184 blinterp
This breaks down into:
- lots of Baseline compilation + Baseline IC compilation / attaching
- 47
RegExpMatcherRaw
- 28 replacement callback
- 3 jitted RegExp direct call from Ion
V8: total 1000
This breaks down into:
- 35 replacement callback
- 22 coordinating turbofan compile
- 21
v8::internal::Runtime_RegExpExecMultiple
- 7
v8::internal::Runtime_StringBuilderConcat
Backbone
TodoMVC-Backbone exercises RegExp functions in add
, Sizzle
, html/<
, delegateEvents
, and a few others.
SM: total 11824
546 replace
: 88 blinterp + 351 baseline + 107 ion
356 test
: 79 blinterp + 160 baseline + 117 ion
373 match
: 58 blinterp + 247 baseline + 68 ion
220 exec
: 33 blinterp + 187 baseline
total replace + test + match + exec: (546 + 356 + 373 + 220) = 1495, (1495 / 11824) = 0.126438
This breaks down into:
341 RegExpMatcherRaw
(called by replace
and match
and exec
)
190 RegExpTesterRaw
(called by test
)
24 RegExpSearcherRaw
(called by replace
)
82 jitted RegExp direct call from Ion
(341 + 190 + 24 + 82) = 637, 637 / 1495 = 0.426087
341 + 190 + 24 = 555 samples in C++, which is just about how much V8 spends in total
V8: total 7483
214 replace
157 test
124 match
64 exec
total replace + test + match + exec: (214 + 157 + 124 + 64) = 559
Vue
TodoMVC-Vue calls RegExp.prototype.test
from isOn
.
SM: total 5890
70 test
: 22 blinterp + 48 baseline
V8: total 3080
Preact
TodoMVC-Preact calls String.prototype.replace
from setProperty
.
SM: total 7672
361 replace
: 27 interpreter + 166 blinterp + 168 baseline
V8: total 4142
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Description
•