Skip to content

Commit

Permalink
Perf: Implement flag driven update dependency graph (#103)
Browse files Browse the repository at this point in the history
![dependency-graph](https://github.com/lightning-js/renderer/assets/6070611/c280c45e-e077-46bb-b477-16ad144645fb)

Updates to cached calculated data within a CoreNode is now updated
according to the above dependency graph.

New optimizations:
- Positioning, sizing and scaling properties now set an `updateType`
(formerly `recalculationType`) flag to indicate an update is needed to
their corresponding matrix.
- Children are not visited unless their `updateType` is flagged with
`Children`
- Any updates to a CoreNode efficiently flags all ancestors up to the
root with `Children`
- Children are not visited if their own `updateType` is 0.
- World Alpha is now update cached.
- Premultiplied Alpha-merged colors are now update cached.
- Calculated Z-Index is now update cached.

Other changes:
- TypeDocs output folder renamed from `docs` to `typedocs`.
- New `docs` folder checked in containing manually written
documentation.
- Added documentation about the Node Dependency Graph

On a RPI test, this took a resolution=1080, multiplier=1, overlay=false
`stress` test from about 40-41 fps to 42 fps.
  • Loading branch information
frank-weindel authored Dec 11, 2023
2 parents 7525d8d + c9e20cb commit d6b0d7d
Show file tree
Hide file tree
Showing 10 changed files with 322 additions and 217 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
node_modules
.DS_store
.idea
docs
typedocs
dist
dist-cfg
dist-vitest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pnpm test
# Run Visual Regression Tests
pnpm test:visual
# Build API Documentation (builds into ./docs folder)
# Build API Documentation (builds into ./typedocs folder)
pnpm typedoc
# Launch Example Tests in dev mode (includes Build Renderer (watch mode))
Expand Down
5 changes: 5 additions & 0 deletions docs/NodeDependencyGraph.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Node Depenedency Graph

The diagram below describes the reactive flow of inputs into cached calculated data elements that are updated during each `update()` of a Core Node.

![Dependency graph describing by way of a water fall the input and output relationship of calculated (and cached) data elements of a node](./images/dependency-graph.png)
Binary file added docs/images/dependency-graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/images/dependency-graph.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
https://lucid.app/lucidchart/f5c48c94-6096-44c5-bca2-97fe2b581095/edit?viewport_loc=-1167%2C-285%2C4800%2C2244%2Cm8WTkWxK2plY&invitationId=inv_44218a81-5bb9-4436-a5e6-5697c146e164
https://lucid.app/publicSegments/view/56aa76d3-d7c2-4020-a3bc-8638084cb22b/image.png
Loading

0 comments on commit d6b0d7d

Please sign in to comment.