Repository navigation
Conversation
Co-authored-by: Manus <dev-agent@manus.ai>
|
Why tho? |
Keep the new parent when a rotation reattaches a child before clearing its old slot. Cover both directions with insertions into the transferred subtree.
Author
Thanks for asking. This addresses the performance issue in #2235. The existing height getters recursively traverse subtrees, and AVL balancing evaluates them repeatedly while walking ancestors, leading to substantially more work than the expected O(log n) insertion. The change caches subtree heights and updates affected ancestors when children change. I've also added regression coverage for rotations and child removal. The existing deletion path still requires a subtree-height refresh, so I'm not claiming O(log n) deletion performance with this change. Local validation reported 587 passing tests and successful linting. I'm happy to add before/after benchmarks if that would help with review. |
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.
Summary
Fixes #2235
Validation
npm test -- --runInBand --coverage=false— 178 test suites and 587 tests passed.npm run lint— passed.git diff --check— passed.