Store floats list in a frame property rather than in nsBlockFrame::mFloats
Categories
(Core :: Layout: Block and Inline, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox129 | --- | fixed |
People
(Reporter: TYLin, Assigned: TYLin)
References
Details
Attachments
(3 files)
Not every block frame contains float elements. I agree with this comment that we can save some memory by storing floats list in a frame property.
Assignee | ||
Comment 1•18 days ago
|
||
After Bug 1902542 Part 5 [1], the pushed floats list is deleted if it is empty.
Therefore, we can simplify MaybeHasFloats()
as suggested in the XXX comment.
Updated•18 days ago
|
Assignee | ||
Comment 2•18 days ago
|
||
EnsurePushedFloats()
either returns the existing pushed floats list or creates
a new empty one. Therefore, it can never return nullptr.
Assignee | ||
Comment 3•18 days ago
|
||
On optimized builds for all desktop platforms, nsBlockFrame
is 192 bytes, and
mFloats
is 16 bytes. With this patch, we can reduce the size of nsBlockFrame
to 176 bytes, saving 8.33% memory on every nsBlockFrame
and its derived
subclasses allocated.
On a real webpage like https://en.wikipedia.org/wiki/Firefox, about:memory
shows that we allocate 0.36 MB of nsBlockFrame
consistently. After this patch,
we allocate 0.33 MB, saving approximately 30 KB (0.36 MB * 8.33%) of the memory.
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/ce65f1574c68 Part 1 - Simplify MaybeHasFloats() that checks pushed floats. r=dholbert https://hg.mozilla.org/integration/autoland/rev/fbd60d2007b0 Part 2 - Annotate EnsurePushedFloats() as MOZ_NONNULL_RETURN. r=dholbert https://hg.mozilla.org/integration/autoland/rev/ccd18b9b52fc Part 3 - Store floats list in a frame property rather than in nsBlockFrame::mFloats. r=dholbert
Backed out for causing crashtest failures on nsSplittableFrame.cpp
Assignee | ||
Comment 6•16 days ago
|
||
See https://phabricator.services.mozilla.com/D214046#7355817 for an analysis of the backout.
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/edc66fd360d1 Part 1 - Simplify MaybeHasFloats() that checks pushed floats. r=dholbert https://hg.mozilla.org/integration/autoland/rev/cff1f22c9444 Part 2 - Annotate EnsurePushedFloats() as MOZ_NONNULL_RETURN. r=dholbert https://hg.mozilla.org/integration/autoland/rev/c2ba52894016 Part 3 - Store floats list in a frame property rather than in nsBlockFrame::mFloats. r=dholbert
Comment 8•16 days ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/edc66fd360d1
https://hg.mozilla.org/mozilla-central/rev/cff1f22c9444
https://hg.mozilla.org/mozilla-central/rev/c2ba52894016
Description
•