Closed Bug 1807003 Opened 3 years ago Closed 3 years ago

consider to optimize Animation::Cancel

Categories

(Core :: CSS Transitions and Animations, defect)

defect

Tracking

()

RESOLVED FIXED
Tracking Status
firefox112 --- ?

People

(Reporter: smaug, Assigned: emilio)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [sp3-anyone])

Attachments

(2 files)

When running the React part of speedometer 2.1, in its DeletingAllItems subtest animation cancelling is taking some time.
https://share.firefox.dev/3Vk15Cz
https://share.firefox.dev/3PJhAXC
It shows up as part of DOM-category.

Could we perhaps avoid some allocations and when the events are finally dispatched, check first if there are listeners?

Severity: -- → S3
Flags: needinfo?(emilio)

FWIW here's a version of one of those profiles, with mozilla::dom::Animation::Cancel focused, and with stack inverted. This shows that all of the time is spent in PR_Now, called by Event::ConstructorInit.

(I don't immediately see where Event::ConstructorInit calls PR_Now; it's probably inlined somewhere.)

In any case: agreed that it'd be nice to avoid dispatching the event in the first place if there are no listeners, if that's something that's easy to detect (not sure).

(In reply to Daniel Holbert [:dholbert] from comment #3)

FWIW here's a version of one of those profiles, with mozilla::dom::Animation::Cancel focused, and with stack inverted. This shows that all of the time is spent in PR_Now, called by Event::ConstructorInit.

Here's that link: https://share.firefox.dev/3JjrOwr

(This is from smaug's very first profile in comment 0 BTW.)

There is no PR_Now() anymore (bug 1807812), I'll reprofile.
The code mentioned in comment 1 is still there.

https://share.firefox.dev/3RcJdJk is a new one, focused on Animation::Cancel

At least there is EffectSet::DestroyEffectSet. That relates to the same code mentioned in comment 1.
I think we should remove property usage and move the relevant stuff to be part of the
nsExtendedDOMSlots https://searchfox.org/mozilla-central/rev/3a13c5ad9c1dbd065e484a399af75eb98c235def/dom/base/FragmentOrElement.h#157

I guess there could be a helper struct which had (strong?) pointer to each of the properties and nsExtendedDOMSlots could have UniquePtr pointing to that struct.

Whiteboard: [sp3-anyone]
Assignee: nobody → emilio
Flags: needinfo?(emilio)

An earlier version of the patch triggered and it wasn't trivial to see
the message.

This should both be faster and simpler. Also will allow us in the future
to animate more pseudos without having to add a gazillion properties.

I think we should try to clear more stuff (maybe the whole animation
data) on unbind, but that's a bit tangential.

Depends on D169859

Keywords: leave-open
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/60ea99a626a7 Add a warning to stderr for cc asserts. r=mccr8
Depends on: 1816915
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8e185891cbfd Centralize animation data in slots. r=smaug,firefox-animation-reviewers,boris
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Blocks: 1725177
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: