Open
Description
Today, we regenerate our 'LayoutTree' that we pass to @jordwalke 's flex
library. We do this every render frame.
This is bad for performance for a couple reasons:
- Generates lots of intermediate garbage (converting style -> layout tree)
- The
flex
library contains optimizations to reuse previous results and short circuit full layout
We should optimize this pipeline by keeping layout nodes around, and just updating their style properties between renders.
A good place to start is here:
Line 195 in e926928
This method, toLayoutNode
, recreates a node every time. We should store it instead with the Node
, and update it when the styles change. Special care will need to be taken to make sure we handle the 'measure' cases correctly.