[meta] Optimize display item memory alignment and padding
Categories
(Core :: Web Painting, enhancement, P2)
Tracking
()
People
(Reporter: mikokm, Unassigned)
References
(Depends on 6 open bugs, Blocks 1 open bug)
Details
(Keywords: meta)
Attachments
(2 files)
Comment 1•7 years ago
|
||
| Reporter | ||
Comment 2•7 years ago
|
||
| Reporter | ||
Updated•6 years ago
|
| Reporter | ||
Comment 3•6 years ago
|
||
Updated•6 years ago
|
Comment 4•6 years ago
|
||
I did a hacky test (removing FLB specific members) to reduce the size of nsDisplayBackgroundColor < 128 bytes so that it went down to the smaller bucket, and ran displaylist_mutate with WebRender.
Display list building time, and total main thread time went down by around 30%. That's a pretty massive change, so I think it's well worth pushing on this metabug as much as possible.
Comment 5•6 years ago
|
||
I found this command, to dump the layout of structs. Attached is the layout for nsDisplayBackgroundColor (with my hacky patch), showing it with a sizeof of 120.
clang++ -cc1 -fdump-record-layouts -I objdir-opt/dist/include -I nsprpub/pr/include -std=c++14 -stdlib=libc++ -I config/external/nspr -I nsprpub/lib/libc/include/ layout/painting/nsDisplayList.cpp -D PR_BYTES_PER_BYTE=1 -D PR_BYTES_PER_SHORT=2 -D PR_BYTES_PER_INT=4 -D PR_BYTES_PER_LONG=8 -D XP_DARWIN -D MOZILLA_INTERNAL_API -D HAVE_64BIT_BUILD -I objdir-opt/ipc/ipdl/_ipdlheaders/ -I ipc/chromium/src/ -I layout/generic/ -I layout/style -I dom/base -I layout/xul -I layout/svg -I layout/tables/
Comment 6•6 years ago
|
||
I think it might be feasible to eventually get to a state where background color is less than 64 bytes.
My theoretical layout is:
0 - vptr
8 - mAbove
16 - uint32 type, index (per-frame-key) and flags
20 - uint32 old-list-index
24 - mFrame
32 - mClipChain index uint32
36 - mASR index uint32
40 - old-list-32bit-ident
44 - mRect
60 - nscolor bg color
Size = 64, rounds to 64, buckets to 64
That's stripping everything that WebRender doesn't need, and tighly packing the rest. It also switches away from pointers, and uses 32bit indices where possible.
It also seems possible to drop the vptr, and hand-roll virtual functions using the type, to save a further 8 bytes, though that's very hard change to write.
There's also 8 bytes of temporary RDL state there (old-list-index and old-list-32bit-ident), which would be nice to avoid as part of the permanent item size. I'll think about that some more.
| Reporter | ||
Updated•6 years ago
|
Updated•3 years ago
|
Description
•