Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spike(virtualized table): Determine baseline performance expectations #4453

Closed
evwilkin opened this issue Jun 26, 2020 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@evwilkin
Copy link
Member

Related to #4322

The ask for this issue is to explore similar solutions to the virtualized table extension and determine what baseline performance requirements the virtualized table should meet. Ideally this would include something along the lines of "for a table with 1000 rows and 10 actions per row, the table is expected to render in x seconds and have a response time to user interaction of x".

This can guide the efforts to improve performance and give a standard to maintain with this component.

@redallen
Copy link
Contributor

redallen commented Sep 28, 2020

Intro

It's difficult to give such measurements since browsers and hardware vary greatly. During testing, my own browser extensions played a role in benchmarks. How rendering is measured can also vary (do we count the time it takes to load scripts? do we count the time it takes to transpile the example on the docs site when consumers likely won't do that? do we use a tool like react-dev-tools to estimate how long a component takes to render without accounting for real-world issues like scroll debouncing?).

Testing

Initial load

Testing our docs site

On my machine on a production docs build it takes 1.452s from page load until the table is fully rendered:
image

For comparison button takes 754ms:
image

These aren't fair product benchmarks since the docs site asynchronously loads these examples and then uses acorn to transpile it (so the length of the example matters). It's a decent estimate, though.

Testing a simple webpack app

I put together a more fair comparison by serving a simple webpack app. It takes 400ms until the table is fully rendered:
image

Going from 100 to 10,000 rows still takes 400ms:
image

For comparison button takes 332ms:
image

Scrolling

Another measure of performance are onScroll events which take 7.6ms on both sites:
image

Conclusions

In simple cases our virtualized table takes 68ms longer to load than a button. In more complex layouts this difference can be up to 700ms longer. The number of rows a virtualized table renders does not seem to impact performance. The time until interactive is the same as the time until rendered (when React renders an HTMLElement it adds event listeners to make it "interactive" too). I think the current primary performance bottleneck is the forced layout reflows used to calculate cell width/height. These take ~9ms total in the simple webpack app, but ~273ms on our docs site. I think we could assume a fixed height and look to enhance these lines upstream in react-virtualized.

Another thing that may help scrolling is batching removing/adding DOM nodes. Currently a lot of time is spent removing/adding individual nodes.

@tlabaj
Copy link
Contributor

tlabaj commented Oct 2, 2020

cc @dgutride

@tlabaj tlabaj closed this as completed Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants