Closed Bug 1643368 Opened 5 years ago Closed 3 years ago

Lazily initialize helper thread JSContexts

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
100 Branch
Tracking Status
firefox100 --- fixed

People

(Reporter: mccr8, Assigned: jandem)

References

(Blocks 1 open bug)

Details

(Whiteboard: [overhead:40k])

Attachments

(2 files)

From bug 1643170, comment 2:

(In reply to Jan de Mooij [:jandem] from comment #2)

For what it's worth, we could easily initialize this more lazily. Most helper thread tasks don't request a JSContext anymore.

We have parsing (will be fixed short-term-ish after Stencil) and some GC tasks. On the other hand, if we can remove this completely later this year maybe we should just wait for that.

The total memory usage for these JSContexts is something like 40kb for the 8 JSContexts, though probably some of these would get initialized even in a small process.

Severity: -- → N/A
Type: task → enhancement
Priority: -- → P3

I looked into this a bit. We can do this in getFirstUnusedContext, but the problem is that GC creates a lot of parallel-tasks so we'd end up allocating most of these contexts in every process anyway.

It would be nice for the GC's parallel tasks to be decoupled from JSContext, maybe with some custom TLS struct that has just the GC-specific bits. Then if we do the same for parse tasks after Stencil we could remove helper thread contexts completely.

Depends on: 1643586
Assignee: nobody → jdemooij
Status: NEW → ASSIGNED

Now that these are only used for off-thread parsing, we can save some memory in
most content processes.

Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bf9eb45bcf84 Allocate helper thread contexts lazily. r=jonco
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: