Closed Bug 1324250 Opened 7 years ago Closed 7 years ago

stylo: Use a global thread pool, instead of one per document.

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: emilio, Assigned: froydnj)

References

(Blocks 1 open bug)

Details

Right now stylo spawns a thread pool per document it styles. That can be pretty inefficient and memory-consuming.

We should switch to use one global thread pool, and use that for all the documents we style.

This is probably easier with the scoped TLS stuff Bobby is working on right now.
Emilio, you should probably coordinate with billm about the Quantum DOM team's plans for task scheduling and prioritization. To be effective, a global thread pool would need to know about all threads, Rust/Rayon and C++, and task priorities.
Flags: needinfo?(emilio+bugs)
That is probably not necessary, because we block the main thread while doing restyling, and thus it is just about not creating too many thread pools. There is nothing to do with scheduling between different documents which are basically all run in the main thread.
Yeah, what Xidorn said, a single stylo thread pool per process is probably acceptable.

If that ends up being not acceptable we may want to figure out a way to reuse other thread pools around, but that'd be a big effort that is probably not worth without a clear reason.
Flags: needinfo?(emilio+bugs)
We should be able to able to spin up the appropriate thread pool somewhere in nsLayoutStatics::Initialize.

NI Manish, who was looking for things to do. :-)
Flags: needinfo?(manishearth)
Flags: needinfo?(manishearth)
Blocks: stylo-memory
Assignee: nobody → nfroyd
This was fixed in https://github.com/servo/servo/pull/15535
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.