Group nodes by hash in deduplicate() - #3294
Conversation
deduplicate() sorted the whole node list with cmpNodes and merged adjacent equal runs. Replace that with a Map keyed on a string identity so merging is linear, and so the output keeps the producer's order instead of imposing cmpNodes order on every caller. nodeKey()/baseKey() are the new identity; cmpNodes is now exported and used only as the independent oracle the tests check nodeKey against, rather than on any hot path. A new test block builds real trees of all three node types and asserts the two agree in both directions -- no wrong merges (one output node per cmpNodes-equivalence class) and no missed merges (no two output nodes cmpNodes-equal) -- plus idempotence and per-field distinguishability. The elixir memoization tests compared node sequences, which only held under the old sorted output. They now compare distributions via expectSameDistribution: same distinct nodes, same total probability on each. That is the actual contract, and it drops the stale ordering comment in elixirDefinitionMemoSimplified that the old behavior justified. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review. Walkthrough
ChangesNode deduplication
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to The change remains merge-ready after normal checks and review; no actionable merge-blocking risk remains. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
[frontend] [Sun Aug 23 17:44:27 UTC 2026] - Deployed c78384a to https://genshin-optimizer-prs.github.io/pr/3294/frontend (Takes 3-5 minutes after this completes to be available) |
Describe your changes
During performance profiling on upopt I noticed the deduplicate() calls were taking really long. This change should speed that up since I used to sort the whole node list; now we're checking a hashmap keyed on a string identity to deduplicate nodes. Nothing relied the sorted node list down the line, so returning an unsorted list is okay & faster.
Issue or discord link
Testing/validation
Updated many tests
Checklist before requesting a review (leave this PR as draft if any part of this list is not done.)
yarn run mini-cilocally to validate format and lint.Summary by CodeRabbit
Bug Fixes
Tests