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

WIP Optimize rendering by caching renderings when possible. #803

Closed
wants to merge 1 commit into from

Conversation

zach-klippenstein
Copy link
Collaborator

Spreadsheet

Note below the renderPassAlternateOneLeaf | SQUARE case – this is the most similar case to most real-world ones. A tree that is a little deep and a little bushy, where only one path some node up to the root actually updates and needs re-rendering. Here we only render 4 nodes, and all other renderings are simply returned from the cache.

Benchmark (treeShape) Mode Cnt Score (before) Error Score (after) Error Units Speedup
WorkflowNodeBenchmark.renderPassAlternateLeaves DEEP avgt 3 310.463 7.559 311.437 83.952 us/op 1.00
WorkflowNodeBenchmark.renderPassAlternateLeaves BUSHY avgt 3 563.374 50.840 556.091 17.334 us/op 1.01
WorkflowNodeBenchmark.renderPassAlternateLeaves SQUARE avgt 3 504.244 8.309 538.211 230.249 us/op 0.94
WorkflowNodeBenchmark.renderPassAlternateOneLeaf DEEP avgt 3 315.172 18.100 312.197 11.376 us/op 1.01
WorkflowNodeBenchmark.renderPassAlternateOneLeaf BUSHY avgt 3 294.026 22.039 178.340 12.926 us/op 1.65
WorkflowNodeBenchmark.renderPassAlternateOneLeaf SQUARE avgt 3 273.824 5.861 10.249 0.794 us/op 26.72
WorkflowNodeBenchmark.renderPassAlternateWorkers DEEP avgt 3 323.121 20.304 327.485 10.509 us/op 0.99
WorkflowNodeBenchmark.renderPassAlternateWorkers BUSHY avgt 3 556.811 80.929 552.366 22.018 us/op 1.01
WorkflowNodeBenchmark.renderPassAlternateWorkers SQUARE avgt 3 502.989 7.628 508.815 31.266 us/op 0.99
WorkflowNodeBenchmark.renderPassAlwaysLeaves DEEP avgt 3 312.049 93.199 0.001 0.001 us/op 312049.00
WorkflowNodeBenchmark.renderPassAlwaysLeaves BUSHY avgt 3 292.758 19.453 0.001 0.001 us/op 292758.00
WorkflowNodeBenchmark.renderPassAlwaysLeaves SQUARE avgt 3 269.063 11.410 0.001 0.001 us/op 269063.00

@zach-klippenstein zach-klippenstein added the enhancement New feature or request label Dec 7, 2019
@zach-klippenstein zach-klippenstein added this to the kotlin v0.22.0 milestone Dec 7, 2019
@zach-klippenstein zach-klippenstein added this to Needs review in Workflow (Kotlin) via automation Dec 7, 2019
@zach-klippenstein zach-klippenstein changed the base branch from zachklipp/single-leaf-benchmark to master December 7, 2019 16:28
@zach-klippenstein
Copy link
Collaborator Author

This makes the process of bubbling outputs up the tree slightly slower (have to call each parent to invalidate its rendering cache), so don't merge this until tick is benchmarked as well.

TODO: Need a benchmark that only updates one leaf, instead of all or none.
zach-klippenstein added a commit that referenced this pull request Jan 19, 2020
This looks like an optimization, but since most `onPropsChanged` are no-ops,
it's not really. This is to prevent code from starting to rely on the fact
that `onPropsChanged` is currently called on ever render pass. This is a small
step towards the behavior in #803, which lets `WorkflowNode`s skip a render
pass for their entire subtree when unnecessary. Making this change now will
help prevent code from being written that will break when that change lands.
@JustinDSN JustinDSN added the kotlin Affects the Kotlin library. label Feb 28, 2020
@zach-klippenstein zach-klippenstein added this to In progress in Workflow via automation Mar 3, 2020
@zach-klippenstein zach-klippenstein removed this from Needs review in Workflow (Kotlin) Mar 3, 2020
@zach-klippenstein zach-klippenstein modified the milestones: v0.24.0, post-v1.0.0 Mar 5, 2020
@zach-klippenstein
Copy link
Collaborator Author

Closing because inactive, might re-open later.

Workflow automation moved this from In progress to Done May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request kotlin Affects the Kotlin library.
Projects
Workflow
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants