MergeState::HasModifiedFrame() is slow
Categories
(Core :: Web Painting, enhancement, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox68 | --- | fixed |
People
(Reporter: mikokm, Assigned: u480271)
References
(Blocks 1 open bug)
Details
Attachments
(9 files, 7 obsolete files)
3.87 KB,
text/html
|
Details | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
This function calls |AnyContentAncestorModified()|, which walks up the frame tree until a modified frame or viewport frame is encountered.
We should be able to avoid this call at least for new items1, if we track the modified ancestor state during display list building.
Updated•6 years ago
|
I have a prototype working where I stash a flag in the newly created nsDisplayItem
if it the DL builder InInvalidSubtree()
is true.
Miko, how are you testing the perf of HasModifiedFrame()
?
Reporter | ||
Comment 2•6 years ago
|
||
(In reply to Dan Glastonbury (:kamidphish) | needinfo me from comment #1)
I have a prototype working where I stash a flag in the newly created
nsDisplayItem
if it the DL builderInInvalidSubtree()
is true.Miko, how are you testing the perf of
HasModifiedFrame()
?
One way to test it is to open a modified version of our DL mutate test and use a profiler. Modified because the default version does not really present the real-world scenario, where frame trees are much deeper.
On my MBP, profiling the attached dl-test-modified.html?count=20000 shows that 4.5% of total time is spent in AnyContentAncestorModified()
.
To make it more visible, I annotated the function with MOZ_NEVER_INLINE
and in XCode Instruments charged GetParentOrPlaceholderForCrossDoc()
to callers.
24.54 s 100.0% 0 s plugin-container (8271)
15.72 s 64.0% 0 s Main Thread 0xd8ed72
2.42 s 9.8% 2.42 s nsDisplayBackgroundColor::CreateWebRenderCommands()
1.78 s 7.2% 1.78 s bincode::internal::serialize_into::h7d2e086eaad43a73
1.11 s 4.5% 1.11 s AnyContentAncestorModified(nsIFrame*, nsIFrame*)
Matt also had an idea that might be a better solution, since it can be done during display list merging, rather than building:
<mattwoodrow> Currently it walks up to the cross-doc root frame
<mattwoodrow> but it should only need to go up to the frame that owns the current list
<mattwoodrow> since if that was invalid, then we wouldn't be merging the current list, we'd have dumped the whole thing
<mattwoodrow> Assuming that the frame owning a list is a content ancestor of all frames in the list (which I think is true, but maybe there's weird cases)
Reporter | ||
Comment 3•6 years ago
|
||
Also move to first cache-line (64-bytes) of nsDisplayItem to improve D-cache hit
when accessing mFrame, mItemFlags, etc.
To short-circuit the expensive call with a flag check.
Depends on D24459
To avoid expensive virtual dispatch in PreProcessDisplayList().
Depends on D24460
Don't walk frame tree all the way to the root.
Depends on D24461
aBuilder->InInvalidSubtree() tracks the modified state. Save the state
during construction of nsDisplayItem and use in ProcessItemFromNewList.
Depends on D24462
Assignee | ||
Comment 10•6 years ago
|
||
Depends on D25348
Reporter | ||
Updated•6 years ago
|
Assignee | ||
Comment 11•6 years ago
|
||
Also move to first cache-line (64-bytes) of nsDisplayItem to improve D-cache hit
when accessing mFrame, mItemFlags, etc.
Assignee | ||
Comment 12•6 years ago
|
||
To short-circuit the expensive call with a flag check.
Depends on D24459
Assignee | ||
Comment 13•6 years ago
|
||
To avoid expensive virtual dispatch in PreProcessDisplayList().
Depends on D24460
Assignee | ||
Comment 14•6 years ago
|
||
Don't walk frame tree all the way to the root.
Depends on D24461
Assignee | ||
Comment 15•6 years ago
|
||
aBuilder->InInvalidSubtree() tracks the modified state. Save the state
during construction of nsDisplayItem and use in ProcessItemFromNewList.
Depends on D24462
Assignee | ||
Comment 16•6 years ago
|
||
Depends on D24463
Assignee | ||
Comment 17•6 years ago
|
||
Try - https://treeherder.mozilla.org/#/jobs?repo=try&revision=d3000884569814d22e3decda8a28cf2c25a474f8
I think the diagnostic asserts are finally fixed!
Assignee | ||
Comment 18•6 years ago
|
||
Assignee | ||
Comment 19•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Comment 20•6 years ago
|
||
Comment 21•6 years ago
|
||
Comment 22•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a59f06022a95
https://hg.mozilla.org/mozilla-central/rev/54b14df56e6f
https://hg.mozilla.org/mozilla-central/rev/ddd57e437228
https://hg.mozilla.org/mozilla-central/rev/8543b9d46521
https://hg.mozilla.org/mozilla-central/rev/2fb940b13971
https://hg.mozilla.org/mozilla-central/rev/2ea2f8533078
https://hg.mozilla.org/mozilla-central/rev/a895c9028b31
https://hg.mozilla.org/mozilla-central/rev/815543d81a1d
Comment 23•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a59f06022a95
https://hg.mozilla.org/mozilla-central/rev/54b14df56e6f
https://hg.mozilla.org/mozilla-central/rev/ddd57e437228
https://hg.mozilla.org/mozilla-central/rev/8543b9d46521
https://hg.mozilla.org/mozilla-central/rev/2fb940b13971
https://hg.mozilla.org/mozilla-central/rev/2ea2f8533078
https://hg.mozilla.org/mozilla-central/rev/a895c9028b31
https://hg.mozilla.org/mozilla-central/rev/815543d81a1d
Comment 24•6 years ago
|
||
Comment 25•6 years ago
|
||
Comment 26•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/55d7bb4de1ab
https://hg.mozilla.org/mozilla-central/rev/5aa53da6778d
https://hg.mozilla.org/mozilla-central/rev/5ef6aebe5737
https://hg.mozilla.org/mozilla-central/rev/4df706db804e
https://hg.mozilla.org/mozilla-central/rev/2459a266d318
https://hg.mozilla.org/mozilla-central/rev/4e0d56e43a73
https://hg.mozilla.org/mozilla-central/rev/069c60c771c6
https://hg.mozilla.org/mozilla-central/rev/817642dc917c
Description
•