Consider using InterpolableList for all animation interpolations. |
|||||
Issue descriptionSome 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.
,
Mar 7 2018
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.
,
Mar 7 2018
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.
,
Mar 7 2018
Here's a profile capture of Preact (over 1000 runs), showing the allocation cost of InterpolableList.
,
Mar 8 2018
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
,
Mar 12 2018
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.
,
Mar 12 2018
(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.)
,
Mar 13 2018
,
Nov 21
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by smcgruer@chromium.org
, Mar 7 2018