Open Bug 1828714 Opened 2 years ago Updated 1 year ago

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)

defect

Tracking

()

ASSIGNED

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:

V8: total 1000

95 replace

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

12 test

Preact

TodoMVC-Preact calls String.prototype.replace from setProperty.

SM: total 7672

361 replace: 27 interpreter + 166 blinterp + 168 baseline

41 RegExpSearcherRaw

V8: total 4142

35 replace

Whiteboard: [sp3]
Blocks: 1827447
Assignee: nobody → jdemooij
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P3
Depends on: 1830727
Depends on: 1830867
Depends on: 1831314
Depends on: 1832558
Depends on: 1833385
Depends on: 1833624
Depends on: 1839422
You need to log in before you can comment on or make changes to this bug.