New issue
Advanced search Search tips

Issue 819738 link

Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Task

Blocking:
issue 808503



Sign in to add a comment

Consider using InterpolableList for all animation interpolations.

Project Member Reported by flackr@chromium.org, Mar 7 2018

Issue description

Some brainstorming to reduce memory use and improve performance in animation interpolation code.

Currently we use InterpolableValue for doing animation interpolations. InterpolableValue can be an arbitrary structure of lists (of lists) of values.

IIUC, we only interpolate between values with the same structure so we could get the same result with better cache coherency, fewer/less memory allocations, no vtable lookups and possibly vector CPU operations by using a flat list, optionally representing the structure separately if necessary to verify we have the same structure between both lists.
 
Description: Show this description
Cc: alancutter@chromium.org
Lucas, do you have an idea for bad the current code is in practice? You mentioned it was in a hot code path.

+alan does this sound reasonable? As far as I can tell there's no reason we have to keep the arbitrary list of lists structure as long as we correctly determine the structures are identical and correctly interpret the flat double list.

Comment 3 by lfg@chromium.org, Mar 7 2018

Cc: jbroman@chromium.org
I'm looking at the Preact Speedometer benchmark, and InterpolableList::Clone is ~1.7% of the total time. More than half of this time is spent on malloc.

Comment 4 by lfg@chromium.org, Mar 7 2018

Here's a profile capture of Preact (over 1000 runs), showing the allocation cost of InterpolableList.

profile_interpolablelist.png
31.4 KB View Download
I think the amount of malloc involved in the animation code path is excessive and would be pleased to see it reduced with something like this.

The tree structure of an InterpolableValue is still needed for additive animations though as there's no guarantee that the shapes are the same there.
Example: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.cpp?type=cs&sq=package:chromium&l=254
Owner: jbroman@chromium.org
Status: Started (was: Available)
Wise or not, I starting looking at this Friday evening. I'm far enough along that I should probably assign this bug to myself to avoid duplicate work.
(It's possible that something even more efficient that could get SIMD support etc could be done in the longer term, but just dropping the allocation by storing numbers inline should help.)

Comment 8 by lfg@chromium.org, Mar 13 2018

Blocking: 808503
Adding the blocking label so we can keep track of the speedometer improvements.
Owner: ----
Status: Available (was: Started)

Sign in to add a comment