Repository navigation
render benchmarks on vitest - #45
Merged
Merged
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
commit: |
cowboyd
approved these changes
Oct 25, 2026
cowboyd
left a comment
Contributor
There was a problem hiding this comment.
How do we integrate this with codspeed so that we can get these clocked on each PR?
Member
Author
|
There is a plugin. I can go ahead and wire that up in a follow up PR! |
5 of 12 tasks
natemoo-re
pushed a commit
that referenced
this pull request
Oct 29, 2026
## What does this PR do? Follow up on #45. This uses codspeed to execute the benchmarks in CI. It gives us deeper information including memory timing. I set it up similar to the TTY repo. ## Type of change <!-- Check one. --> - [ ] Bug fix - [ ] Feature - [ ] Refactor (no behavior change) - [ ] Documentation - [ ] Performance improvement - [ ] Tests - [x] Chore (dependencies, CI, tooling) ## Checklist - [x] All tests pass (`pnpm test`) - [x] Files are formatted (`pnpm format`) - [x] I have added/updated tests for my changes (if applicable) - [ ] I have added a changeset ## AI-generated code disclosure <!-- If any part of this PR was generated by AI tools (Copilot, Claude, GPT, Cursor, etc.), check the box. This is fine — we just need to know so reviewers can pay extra attention to edge cases. --> - [ ] This PR includes AI-generated code
cowboyd
added a commit
that referenced
this pull request
Nov 6, 2026
## What does this PR do? Deep trees make layout's recursive generator delegation increasingly expensive due to the way JavaScript handles generator delegation. This change traverses child iterators with an explicit stack, so that externally the API remains exactly the same, but internally it is much more performant. The performance issue is demonstrated by the rendering benchmarks added in #45, so no separate issue is needed. Tests cover a 20,000-level tree, adjacent text grouping, stable IDs, subtree layout, and early-return closing behavior. ## Benchmark comparison Ran the existing rendering benchmark suite before and after: 120 cases per version, sequentially on the same machine with identical dependencies and settings. Values below are end-to-end mean rendering times in milliseconds. Initial render, 2,000 components: | Shape | Recursive (ms) | Iterator stack (ms) | Speedup | | --- | ---: | ---: | ---: | | Grass | 3.06 | 2.79 | 1.1× | | Maple | 3.32 | 2.88 | 1.2× | | Bush | 4.32 | 2.87 | 1.5× | | Evergreen | 68.92 | 3.22 | 21× | | Sequoia | 185.15 | 2.98 | 62× | | Bamboo | 189.57 | 3.01 | 63× | Mutation workloads, 2,000-component bamboo trees: | Workload | Recursive (ms) | Iterator stack (ms) | Speedup | | --- | ---: | ---: | ---: | | Single value update | 205.97 | 1.91 | 108× | | Batch 100 updates | 202.68 | 2.01 | 101× | | Add one component | 206.72 | 2.07 | 100× | | Add 100-component subtree | 206.69 | 2.25 | 92× | ## Type of change - [ ] Bug fix - [ ] Feature - [ ] Refactor (no behavior change) - [ ] Documentation - [x] Performance improvement - [ ] Tests - [ ] Chore (dependencies, CI, tooling) ## Checklist - [x] All tests pass (`pnpm test`) - [x] Files are formatted (`pnpm format`) - [x] I have added/updated tests for my changes (if applicable) - [ ] I have added a changeset ## AI-generated code disclosure - [x] This PR includes AI-generated code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
We were starting to see places which would bottleneck so it was worth getting a few rough checks in place so we at least know we are in the ballpark.
Type of change
Checklist
pnpm test)pnpm format)AI-generated code disclosure
I used it to help spike out and play around with edge cases, look and feel, etc. I refined and edited it from there.
Perf Results
Results on an m1 air