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

Render loop optimizations #91

Merged

Conversation

wouterlucas
Copy link
Contributor

@wouterlucas wouterlucas commented Nov 23, 2023

We've spent a few rounds of doing render loop optimizations and discovered there are several improvements that can be made. Consider this round # 1 of our performance hunt.

Current list of changes:

  • Pause RAF when there are no updates
  • Do not render if there are no tree updates
  • Animation loop code optimizations
  • Change node sorting to presorting
  • Disable Batched Shader for now, due to branching issues
  • Excessive texture rebinds per draw

Benchmarking
We've used two benchmarking methods:

  • Blits 1080p stress test of a continuous animation with 103 images
  • Simple 720p animation on L2 and L3

Observations, all tested on a RPI3 with WPEWebKit 2.42:
Simple animation on L2 @ 720p rendered at ~59 FPS
Simple animation on L3 @ 720p rendered at 33 FPS at the start of this exercise
Simple animation on L3 @ 720p renders at 47 FPS with the above changes, excluding texture rebinds
Simple animation on L3 @ 720p renders at ~59 FPS

Blits stress test @ 1080p renders at 12 FPS prior to these changes
Blits stress test @ 1080p renders at 27 FPS with the above changes excluding texture rebinds
Blits stress test @ 1080p renders at 47 FPS with a texture rebind hack (TODO implementation).
Blits stress test @ 1080p renders at 31 FPS with changes

@erikhaandrikman for all the support & hunting 🤟

Todo:

  • Come up with a way to handle texture rebinds
  • Run visual regression testing

@wouterlucas wouterlucas added the do not merge Do not merge this PR. It may not be ready or depends on another PR to be merged first. label Nov 23, 2023
@CLAassistant
Copy link

CLAassistant commented Nov 23, 2023

CLA assistant check
All committers have signed the CLA.

- Implement no render on no changes, add pause Raf handling
- Implement recalculation updates, move clipping to CoreNode.
- Avoid using forEach and casting the same props to an array each time.
- Do not sort on every draw and implement presorting of the children.
- Switch to Default shader, will need to optimize batched rendering.
- Remove duplicate array in WebGlCoreRenderer and add RenderOps or Quads directly.
- Make sure zIndex reordering only happens on .update().
- Avoid binding the same texture again.
- Added simple stress test.

Co-Authored-By: erikhaandrikman <erik_haandrikman@comcast.com>
@wouterlucas wouterlucas removed the do not merge Do not merge this PR. It may not be ready or depends on another PR to be merged first. label Dec 5, 2023
@frank-weindel frank-weindel merged commit b96eb19 into lightning-js:main Dec 5, 2023
2 checks passed
@wouterlucas wouterlucas linked an issue Jan 16, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mature/enhance update loop
3 participants