Closed
Bug 1367878
Opened 7 years ago
Closed 2 years ago
RegExp handling shows up in Facebook profile
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
INCOMPLETE
Performance Impact | low |
People
(Reporter: smaug, Unassigned)
Details
(Keywords: perf)
Updated•7 years ago
|
Whiteboard: [qf] → [qf:p1]
Comment 1•7 years ago
|
||
js::irregexp::CompilePattern takes 133ms (mostly js::irregexp::*::Emit), and as far as I know, this code is not interruptible as of today.
I see 2 "simple" ways to approach this problem, which both have pitfalls:
1/ We could add checks to call the interruption callback in the *::Emit functions, such that we can stack event loops, but we would add JS race issues in facebook.
2/ Quantum DOM would save us by making sure we can switch between multiple threads, but this would not solve the 133ms facebook-only pause.
Does this issue exists also in Chrome, or did they changed irregexp to better handle this parsing issue?
Flags: needinfo?(bugs)
Reporter | ||
Comment 2•7 years ago
|
||
Bobby, do we have some way to capture some kind of profiles on Chrome?
Flags: needinfo?(bugs) → needinfo?(bchien)
Comment 3•7 years ago
|
||
A native profiler should be usable to profile Chrome manually if someone wants to verify whether they hit the same irregexp code or not.
Reporter | ||
Comment 4•7 years ago
|
||
Last time I tried, Chrome builds didn't have symbols included.
Comment 5•7 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #2)
> Bobby, do we have some way to capture some kind of profiles on Chrome?
Mike, could you help Olli to capture the profiles? Thanks.
Flags: needinfo?(bchien) → needinfo?(mlien)
Comment 6•7 years ago
|
||
(In reply to Bobby Chien [:bchien] from comment #5)
> (In reply to Olli Pettay [:smaug] from comment #2)
> > Bobby, do we have some way to capture some kind of profiles on Chrome?
>
> Mike, could you help Olli to capture the profiles? Thanks.
We only have Chrome's tracing log, e.g., https://tinyurl.com/mzen5lo, and just like Olli mentioned it doesn't have symbols.
Flags: needinfo?(mlien)
Comment 7•7 years ago
|
||
71ms was spent in js::irregexp::NativeRegExpMacroAssembler::BindBacktrack which has a linear search, this seems something we can improve. I'll check how it behaves usually.
Comment 8•7 years ago
|
||
(In reply to Ting-Yu Chou [:ting] from comment #7)
> 71ms was spent in js::irregexp::NativeRegExpMacroAssembler::BindBacktrack
> which has a linear search, this seems something we can improve. I'll check
> how it behaves usually.
Hmm, I don't see this symbol from the profile that I just captured on Nightly 20170710100245.
Comment 9•7 years ago
|
||
I didn't see this in either Firefox nightly or in Google Chrome profile (by searching for regexp in the profiled native stack). Also given the reported number in bug 1366960 (76% = 172 ms), I think the regular exception processing happens long *after* the chat tab is opened and doesn't slow down the opening of the tab. It does jank the browser, but it's a separate issue. We should unblock 1366960.
Updated•7 years ago
|
Whiteboard: [qf:p1] → [qf:p2]
Comment 11•7 years ago
|
||
(In reply to Nicolas B. Pierron [:nbp] from comment #1)
> js::irregexp::CompilePattern takes 133ms (mostly js::irregexp::*::Emit), and
> as far as I know, this code is not interruptible as of today.
>
> I see 2 "simple" ways to approach this problem, which both have pitfalls:
> 1/ We could add checks to call the interruption callback in the *::Emit
> functions, such that we can stack event loops, but we would add JS race
> issues in facebook.
> 2/ Quantum DOM would save us by making sure we can switch between multiple
> threads, but this would not solve the 133ms facebook-only pause.
>
> Does this issue exists also in Chrome, or did they changed irregexp to
> better handle this parsing issue?
Would it be possible to do the irregexp jit-compile in the background and use the VM-based regexp impl until then? Siimilar to how we background Ion-compilation?
Comment 12•7 years ago
|
||
Sean can you take a look to see if there is something we can do here? Do we need to update our fork from Chrome's
Flags: needinfo?(sstangl)
Whiteboard: [qf:p2] → [qf:p3]
Comment 13•7 years ago
|
||
We should first check if this is still a problem; I fixed a number of regex-related perf issues this year. If it still shows up we can look at a profile to see where we're spending our time.
Updated•3 years ago
|
Performance Impact: --- → P3
Whiteboard: [qf:p3]
Updated•2 years ago
|
Flags: needinfo?(sstangl)
Comment 14•2 years ago
|
||
We've updated our regexp import (multiple times since), and 5 years is a long time in Facebook time... if it shows up again, let's open a new bug.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•