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

Notebook scrolling perf improvement #133571

Merged
merged 7 commits into from Sep 22, 2021
Merged

Notebook scrolling perf improvement #133571

merged 7 commits into from Sep 22, 2021

Conversation

rebornix
Copy link
Member

@rebornix rebornix commented Sep 22, 2021

When scrolling a notebook, the notebook list view is creating cells, relayouting them and deleting them in a short period of time. Though we are using the same list view as the file explorer or settings editor, rendering a single notebook cell is much more costly. One typical improvement we can do is postponing rendering of costly component but it might harm the perceived experience (e.g. more flickering).

This PR tries to improvement the smoothness of scrolling by:

  • Batch DOM write and read
    • When rendering the viewport, the list view will try to render all possible visible cells, insert their DOM nodes into the DOM tree
    • It will then check each one's dynamic height
    • In this PR, we will only check offsetHeight/clientHeight of output elements after all cells are initially rendered, to ensure that the layout is invalidated only once
  • FastDomNode to avoid redundant DOM style updates
  • transfom: translateY for updating top properties for focus indicator.

@rebornix rebornix self-assigned this Sep 22, 2021
@rebornix rebornix added this to the September 2021 milestone Sep 22, 2021
@rebornix rebornix merged commit b5a259b into main Sep 22, 2021
@rebornix rebornix deleted the rebornix/batch-dom-read branch September 22, 2021 22:19
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant