-
Notifications
You must be signed in to change notification settings - Fork 191
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
[perf] batch-destroy #1529
[perf] batch-destroy #1529
Conversation
cee6d85
to
8c96913
Compare
Some concerns brought up from @runspired :
PerfNotes:
|
@NullVoxPopuli in my understanding we don't remove parentElement here, and in addition, we do removal after all destructors for list items is executed, concern is valid, but it seems not related to code changes. There is only one possible case I was thinking - where opcodes in list has different parent or we have "some node" in the middle of the list. Something like: {{#each @items as |item|}}
{{yield item}}
{{#in-element item.node}} foo-bar {{/in-element}}
{{/each}} But, it seems yield has it's own destructor opcode, and in-element too. |
Comments from discord (related to perf comparison): clear code branches is not included to creation (should not side on this stuff), I would propose to change ordering of tests after some cooling time, technically first results may be faster because of CPU 🙂 if we see 14% improvement in only one (and expected use-case) and 5-17% regression for all cases, it may be a case where we actually more than 14% faster in "all nodes removal", but because of CPU throttling (let it be 10%), we see degradation in other metrics |
8c96913
to
b80e515
Compare
it seems replace elements
|
296eb4e
to
6ca10f6
Compare
6ca10f6
to
b37fc0c
Compare
Closing because it require VM list change |
Main idea here is to remove unnecessary work if we need to sync rendered list with new list with
0
length (list removal case, may be found in real-life applications where we switching between categories, or filtering / searching items).Proposed changes reduce function nesting for this case, and at least remove
2
code branches peropcode
(list item).Possible improvement: (require vm updates)
if we had "list-start", "list-end" DOM marks, we could improve clear function, and instead of iterating over per-opcode bounds, we could just remove all from "list-start" node to "list-end" node
https://github.com/glimmerjs/glimmer-vm/blob/main/packages/%40glimmer/runtime/lib/bounds.ts#L54
UPD: looks like we could clear bounds itself.
Gives us in total
3
branches improvements per opcode.Guessing here - since we don't remove
expensive
operations, such as destructors and one-to-one node list removal (instead of parent node), I would expect up to 5% in remove all case boost.