Closed Bug 1292370 Opened 8 years ago Closed 6 years ago

stylo: reduce memory usage by replacing cached style struct pointers with a bitfield

Categories

(Core :: CSS Parsing and Computation, defect, P4)

defect

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox57 --- wontfix

People

(Reporter: bholley, Unassigned)

References

(Blocks 1 open bug)

Details

Right now nsStyleContext has a bunch of pointers to the style structs. For the Gecko case this is necessary, because the style contexts own the style structs (modulo inheritance and sharing). But in Stylo, they're just a cache of a pointer we obtained via an FFI call to Servo_GetStyleFoo.

We should measure the overhead of the FFI call. If it's insignificant, we should just call through to query the value each time. If it matters, we can teach Gecko about the pointer offsets inside a ServoComputedValues and query them directly with some pointer arithmetic (and static_assert that we're getting it right).

We also use these pointers to indicate whether we've ever used the style information from a given style struct, which allows us to short-circuit a bunch of work in CalcStyleDifference. But we can do this by replacing an array of pointers with a bitfield, and save about 20 pointers worth of memory, which is nothing to sneeze at.
Blocks: stylo-memory
Priority: -- → P3
No longer blocks: stylo
This will be a significant memory win, but we can't do it until after we drop support for the old style system.
Priority: P3 → P4
status-firefox57=wontfix unless someone thinks this bug should block 57
This has been done.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.