Skip to content

Performance: Cache LayoutNodes #220

Open
@bryphe

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:

pub toLayoutNode = (pixelRatio: float) => {

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.

Metadata

Assignees

No one assigned

    Labels

    A-technicalArea: Technical issues not directly related to featureshelp wantedExtra attention is neededperformance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions