Open Bug 1499538 Opened 7 years ago Updated 2 years ago

Reduce the overhead of JS helper threads

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

People

(Reporter: erahm, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

JS helper threads [1] contribute a significant amount to per process overhead (see bug 1476442) and we'd like to reduce that. There are several options ranging from simply reducing the max amount of threads [2] to cycling down threads and respawning as needed in order free up committed stack space (nsIThreadPool [3] already has this logic). It would be useful to run some tests against awfy / talos to see what effect reducing the threadcount has. Additionally gathering some data on thread utilization would be helpful as well. [1] https://searchfox.org/mozilla-central/rev/3d989d097fa35afe19e814c6d5bc2f2bf10867e1/js/src/vm/HelperThreads.h#106 [2] https://searchfox.org/mozilla-central/rev/3d989d097fa35afe19e814c6d5bc2f2bf10867e1/js/src/vm/HelperThreads.cpp#86-104 [3] https://searchfox.org/mozilla-central/rev/3d989d097fa35afe19e814c6d5bc2f2bf10867e1/xpcom/threads/nsIThreadPool.idl#49-58
Kris, can you take a look at this?
Assignee: nobody → kwright
When I tested using these threads for GC work and for parsing I found very little gain when using more that half the threads, so I think there is scope for reduction. The optimum number of threads probably depends on more factors than the reported number of CPUs though.
For wasm compilation, which is massively parallel, we do see improvements as we add cores until we hit a NUMA limit, at which point performance drops again. So a fair amount of benchmarking that we did for the baseline compiler was done with careful control of CPU affinity. Anyone testing should probably be mindful of this. 95% of our desktop use base has <= 4 cores anyhow, based on the data report (https://data.firefox.com/dashboard/hardware), and it's a fair bet that almost none of them have NUMA systems.
Agreed; we definitely see benefits up to 8, but adding logic to dynamically ramp up/down the number of helper threads based on activity makes sense.
Depends on: 1501438
Priority: -- → P2
Depends on: 1508296
Assignee: kwright → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.