Skip to content

[ScrollArea] Possible performance optimization? #5703

@Gerbuuun

Description

@Gerbuuun

Package

v4.x

Description

Currently the ScrollArea component runs measureElement on each item when virtualising, no matter what.
This is quite an expensive function and in a large list it causes layout thrashing.

For a list with items of dynamic size, there is nothing we can do about it afaik.

However, in the case where there is a huge list of components which are all the same size there is no reason to do this calculation on each component. Using the estimateSize instead increases the performance significantly.


Not calling meaureElement does break resizing. If scaled (e.g. responsive design), the virtualizer does not update the rows accordingly...

Additional context

With measureElement:

virtual-list-layout-thrashing.mp4

Without measureElement:

virtual-list-no-layout-trashing.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttriageAwaiting initial review and prioritizationv4#4488

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions