FormAutofillHeuristics testRegex is slow on Android in various TodoMVC
Categories
(Core :: JavaScript Engine: JIT, defect, P3)
Tracking
()
People
(Reporter: jnicol, Unassigned)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [sp3])
https://share.firefox.dev/3LcbJJp
It takes to long generally, and is showing up during the test time to a greater extent than on desktop.
Updated•2 years ago
|
Updated•2 years ago
|
Reporter | ||
Comment 1•2 years ago
•
|
||
In JS the RegExp objects are saved globally here and therefore persisted across runs. They are initialized lazily here by overriding the get() property on the first access, then un-overriding it. So the JS code looks correct to me in terms of caching.
For each FormAutofillChild._doIdentifyAutofillFields()
(which is called when an input element is focused first after page load), we end up calling testRegex()
a few times per regexp, twice where the input string hasLatin1Chars()
, and once where it does not. So on the first iteration we compile the regex twice to byte code. For the next 2 and a bit iterations we reuse the cached byte code.
Then we eventually decide the regexp is hot and decide to tier up to jit code. Which means we must recompile.
In between each iteration discardJitCode()
is called. So once we have tiered up to JIT code, we now must recompile each regexp each iteration.
So perhaps we want to be less eager to call discardJitCode()
Updated•2 years ago
|
Comment 2•2 years ago
|
||
Or we might want to reset the compilation counter when we discard the Regex.
Comment 3•2 years ago
|
||
I was going to suggest that we should compile immediately (instead of interpreting) if we had ever compiled code and then discarded it, but looking at the code I think that already happens: the ticks_
counter will remain at zero (it counts down from JitOptions.regexpWarmUpThreshold, which defaults to 10), so we will compile eagerly for future executions.
Maybe we could add some way for the chrome code to annotate the regexp as important, and not discard its jitcode?
Reporter | ||
Comment 4•2 years ago
|
||
FWIW this no longer has nearly as large an impact. I believe smaug's recent scheduling changes mean this occurs outwith the measured test time more often
Description
•