Conversation
Add benchmarkTreeCorePrimitives.ts for realistic createTree/rebuildTree measurement. Includes: - Realistic init path: createTree → setMounted(true) → rebuildTree() - Feature profiles: minimal, root-default, virtualized-card - Rebuild modes: unchanged and expanded-copy (changed-state) - Large-set focus: large-wide (8k), large-monorepo (2.4k), linux (93k) - Deterministic checksum guards for drift detection - JSON output with --compare baseline diffing - Shared benchmark helpers extracted from fileListToTree benchmarks Also refactors benchmarkFileListToTree.ts to use shared helpers and adds expanded folder fixture support for realistic expansion state.
Two allocation-reduction optimizations that significantly reduce initialization cost for large trees (93k linux kernel file set): 1. getItemsMeta traversal (tree/feature.ts): Replace per-node path.concat() and path.includes() with a reusable lineage stack + Set for circular-reference detection. Eliminates O(depth) array allocations and O(depth²) includes scans per node. 2. buildStaticInstance finalization (build-static-instance.ts): Replace Object.entries(definition) with for-in iteration to avoid allocating a key-value pair array on every instance method wiring call. This is the hot path during rebuildItemMeta for large trees. Benchmark results (linux 93k file set, virtualized-card profile): - Initialize median: ~201ms → ~69ms (-66%) - Changed-state rebuild median: ~28ms → ~21ms (-25%) All existing tests pass with identical behavior.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
[trees] Optimize large tree initialization (~66% faster)