Open Bug 2079371 Opened 1 month ago Updated 1 month ago

Avoid recomputing animation properties when creating finite CSS text-color transitions

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

ASSIGNED

People

(Reporter: perf-ai-bot, Assigned: denispal)

References

(Blocks 1 open bug)

Details

(Whiteboard: [foofrix:e6b639c2-dd77-4e99-9d40-c3fe8cce45ac])

Attachments

(1 external file, 1 obsolete file)

Corrected (v2) CSS transition creation fast path, scoped to the color longhand.

Problem

Every newly created CSS color transition pays a redundant computed-value round trip on the content main thread inside Speedometer 3's measured windows. nsTransitionManager::DoCreateTransition already holds the transition's start and end values as computed AnimationValues, but it uncomputes them into keyframe declarations and KeyframeEffect::SetKeyframes -> UpdateProperties -> BuildProperties then clones the keyframes and calls Servo_GetComputedKeyframeValues + BuildSegmentsFromValueEntries to recompute exactly those AnimationValues and rebuild the single from/to segment, allocating and sorting along the way. In the TodoMVC-Vue baseline profile the transition-creation machinery is ~190 of ~7220 measured-window samples (~2.6% of measured main-thread time), of which the redundant keyframe recomputation portion (~67 samples: GetAnimationPropertiesFromKeyframes, Servo_GetComputedKeyframeValues, keyframe Clone, BuildSegmentsFromValueEntries) is pure overhead for color transitions; CompletingAllItems starts ~100 color transitions per iteration because todomvc-app-css puts "transition: color .4s" on every todo label, and the same CSS is shared by all SP3 TodoMVC subtests. For properties other than color the recomputation is NOT redundant (it re-applies style adjustments such as display blockification, as the starting-style-adjustment.html WPT demonstrates), so the fast path is restricted to the color longhand where skipping it is exactly equivalent.

Performance

  • Benchmark: speedometer3-todomvc-vue
  • Component: Layout
  • Local Improvement: 1.6%

Validation

Blocks: speedometer3

Please move this bug to the correct component.

Once the Phabricator patch is ready for review, please commandeer it.

Flags: needinfo?(dpalmeiro)

Corrected (v2) CSS transition creation fast path, scoped to the color longhand.

Assignee: nobody → dpalmeiro
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #9655226 - Attachment is obsolete: true
Flags: needinfo?(dpalmeiro)
Component: Performance: Automated Findings → Layout
Summary: Corrected (v2) CSS transition creation fast path, scoped to the `color` longhand. → Avoid recomputing animation properties when creating finite CSS text-color transitions

Speedometer 3’s TodoMVC tests trigger many text-color transitions when items are marked complete. For transitions with finite computed color components, this patch builds the animation property directly, skipping the Stylo work that recomputes the endpoints from keyframes. Try results show median Speedometer 3 score improvements of approximately 0.2–0.8%. Before-and-after TodoMVC-Vue profiles show approximately 25% fewer inclusive samples in DoCreateTransition.

The severity field is not set for this bug.
:emilio, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)
Severity: -- → S3
Flags: needinfo?(emilio)
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: