Skip to content

Performance: memoization #291

Description

@andreialecu

Hi again.

While fixing the other issue yesterday, it got me thinking that trying to determine which font to use in each render might not be super efficient.

I decided to take a look at it from a performance perspective, here are my findings.

It appears that on an Oppo A72 Android device, it takes about 1ms to execute the logic in the overridden render function. Now, if there are 16 Text nodes on the screen, that's already 16 ms, so a dropped frame.

Screenshot 2021-06-25 at 10 15 34

If however I add some memoization, it drops to 0.1ms most of the time, which is a 10x improvement:

Screenshot 2021-06-25 at 10 19 31

I'll open a PR shortly with this for your consideration

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions