Open Bug 1818337 Opened 1 year ago Updated 10 months ago

Be more aggressive about JitScripts for off-thread parses

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

People

(Reporter: tcampbell, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Attachments

(2 files)

Similar to approach in Bug 1736057, where we generate full bytecode for off-thread parses, we can eagerly allocate JitScripts for those same parses.

The naive way to do this is to leverage the Stencil-Instantiation mechanism to have an additional instantiation option to create the JitScripts as well. This works nicely because we have a full list of JSFunctions in a vector at that point and don't need to do any searching. Using the off-thread parse heuristics lets us avoiding impacting event handlers or evals.

Today the Stencil-Instantiation is on main-thread, but can happen early on during load (such as waiting for network). In Bug 1773339 we are clearing up how all parse-related threads work so there will be more easy opportunities to do more of this off-thread.

JitScripts are getting a lot cheaper to allocate these days, and memory impact is lowered.

As a starting point, we should also subscribe to the 'ContentChild::RecvNotifyProcessPriorityChange' signal to limit this heuristic to foreground processes.

If this is stable enough, we can look at more aggressive jitting of other tiers, though there may be smarter ways to do that then with this blunt hammer.

The browsertime harness is interacting in strange ways so I'm not seeing changes on CI. Locally I see about a 6% improvement for this limited JitScript approach. Pageload also gets 5-10% faster which is a bit surprising, but also leveraging the Stencil structures gives better locality. AWSY shows no impact as expected since we don't quantify transient memory usage.

TODO: Avoid breaking no-jit builds
TODO: Add jsshell flag for evaluate and command line.
TODO: Add dom::ScriptLoader pref for this

Whiteboard: [sp3]
Severity: -- → N/A
Priority: -- → P1
Status: NEW → ASSIGNED
Assignee: tcampbell → nicolas.b.pierron

Is this still being planned? Interpreter time is not showing up as a problem on speedometer3, so entering BaselineInterpreter earlier probably wouldn't affect our score, but it still seems like a useful thing to have.

Flags: needinfo?(nicolas.b.pierron)

I did not know why this bug is assigned to me. I will unassigned my-self in the mean time.

(In reply to Markus Stange [:mstange] from comment #5)

Is this still being planned? Interpreter time is not showing up as a problem on speedometer3, so entering BaselineInterpreter earlier probably wouldn't affect our score, but it still seems like a useful thing to have.

Ok, I will keep that in mind unless someone else comes before.

Assignee: nicolas.b.pierron → nobody
Status: ASSIGNED → NEW
Priority: P1 → P2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: