Closed Bug 1543806 Opened 6 years ago Closed 4 years ago

Incremental GC can block off-thread parsing

Categories

(Core :: JavaScript: GC, defect, P1)

defect

Tracking

()

RESOLVED FIXED
Performance Impact high
Tracking Status
firefox69 --- wontfix
firefox70 --- wontfix
firefox71 --- fix-optional

People

(Reporter: tcampbell, Assigned: mgaudet)

References

(Blocks 1 open bug)

Details

(Keywords: perf:pageload)

(Cloning from Bug 1543776 into JS component)

The following microbenchmark stalls offthread parsing while an incremental gc is occuring. This has shown up in page load profiles.

var doGC = true;

// Generate a long script to parse
fragment = " + a";
for (var i = 0; i < 19; ++i) {
    fragment = fragment + fragment;
}
offThreadScript = "var a = 2; var x = " + fragment + ";";

// Start incremental GC
if (doGC) {
  startgc(1);
}

// Start the off-thread
var jid = offThreadCompileScript(offThreadScript);

// Spin main-thread
for (var i = 0; i < 1000000; ++i) {
    with({}){} // Prevent IonMonkey
}

// Finish incremental GC
if (doGC) {
  finishgc();
}

// Wait for parse result
runOffThreadScript(jid);

Perf profiles imported into GeckoProfiler (thanks :jesup!)

Without_GC: https://perfht.ml/2UPvwFk
With_GC: https://perfht.ml/2UPwhya

Whiteboard: [qf:p1:pageload]
Assignee: nobody → mgaudet

Matthew, what is the progress around this issue?

Flags: needinfo?(mgaudet)

In progress, but still a couple months out. I've added the meta bug I have been working under to the blockers list for this one, so the dependency tree is more clear.

Depends on: 544117
Flags: needinfo?(mgaudet)
Depends on: 1544117
No longer depends on: 544117

Using the microbenchmark Ted wrote in comment #1, modified to dump timing, I will note that I do still see delay introduced by the finishGC of ~500ms.

Depends on: stencil-mvp
No longer depends on: 1544117

This Bug 1658631 landed this underlying issue is solved so I will close this bug. We haven't turned on by default in browser yet, but are working towards that soon in Bug 1662102.

tcampbell@ironman:~/projects/gecko.dev$ ./mach run stencil-bench.js 
Wall-time: 1224ms
tcampbell@ironman:~/projects/gecko.dev$ ./mach run --no-off-thread-parse-global stencil-bench.js 
Wall-time: 960ms
Status: NEW → RESOLVED
Closed: 4 years ago
Depends on: 1658631
No longer depends on: stencil-mvp
Resolution: --- → FIXED
Performance Impact: --- → P1
Keywords: perf:pageload
Whiteboard: [qf:p1:pageload]
You need to log in before you can comment on or make changes to this bug.