Closed Bug 1221842 Opened 6 years ago Closed 5 years ago

Don't reallocate display item geometry if nothing changed

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox45 --- affected
firefox47 --- fixed

People

(Reporter: mattwoodrow, Assigned: mattwoodrow)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Currently we always allocate a new nsDisplayItemGeometry when processing a display item, even if nothing actually changed.

If the invalidation region is empty, then nothing has changed, so we can just reuse the old geometry and make life easier for the memory allocator.
Attachment #8683423 - Flags: review?(roc)
We could take this a step further, and update existing geometry in-place when there are changes, but this is a rarer common case and a lot more work.
Does this work with nsImageGeometryMixin where we update the draw result sometimes but don't mark anything as invalid?
ni for comment 2
Flags: needinfo?(matt.woodrow)
https://hg.mozilla.org/integration/mozilla-inbound/rev/e8b7b5321acddf4316dacfd521400fcef9c3ce7b
Backed out changeset b456daa0503f (bug 1221842) for B2G ICS Emulator Opt R7 bustage on a CLOSED TREE
(In reply to Timothy Nikkel (:tn) from comment #2)
> Does this work with nsImageGeometryMixin where we update the draw result
> sometimes but don't mark anything as invalid?

Yeah, I believe this is fine.

We update the draw result on the stored geometry object, it shouldn't matter if this got freshly allocated during DLBI or was retained from the previous cycle.
Flags: needinfo?(matt.woodrow)
https://hg.mozilla.org/mozilla-central/rev/230f12b4303c
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Target Milestone: mozilla46 → mozilla47
This resulted in another nice improvement in the tp5o_scroll Talos benchmark:

https://treeherder.mozilla.org/perf.html#/alerts?id=2014&framework=1&hideImprovements=0
Depends on: 1243409
Depends on: 1243557
You need to log in before you can comment on or make changes to this bug.