anim_rigs: index cross-dictionary joins (ANIM-RIGS-JOIN-INDEX) #1169
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1169
Loading…
Reference in a new issue
No description provided.
Delete branch "perf/anim-rigs-join-index"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Item ID:
ANIM-RIGS-JOIN-INDEXPrecomputes the union of all dictionary key sets once in
tools/anim_rigs.py:join_rbf0()so unresolved cross-dictionary lookups check membership in O(1) instead of rescanning every dictionary per entry.Changes
tools/anim_rigs.py(join_rbf0): Computesall_keys = set().union(*keys.values()) if keys else set()once and replacesany(h in k for k in keys.values())withh in all_keys, preserving exact category counts (resolved,in_another_dictionary,no_dictionary_named_source,key_missing).tests/test_anim_rigs_join_index.py: Adds synthetic parity checks against the reference implementation and scale tests across dictionary misses.Verification
python -I scripts/check_no_game_data.py).Reviewed and verified. Optimizes cross-dictionary join operations in
tools/anim_rigs.pyfrom O(D * K) to O(1) by precomputing unified key union sets (set().union(*keys.values())), achieving a ~12.7x speedup on dictionary misses. Verified viatests/test_anim_rigs_join_index.py. 100% clean-room.Recommendation: [MERGE]
Reasoning:
anim_rigs.join_rbf0builds the union of all dictionary hashes once instead of rescanning every dictionary per unresolved entry (about 12.7x faster per the author), with the same counts. Tiny, obviously equivalent change with a parity test. Minimal PR description. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict withmain. Merge once the queued checks are green.Impact level: 2/10
@abnalstlll-byte @Deedlyy Thanks for the review and
[MERGE]recommendation! Updated the PR description with a full summary of theall_keysunion optimization intools/anim_rigs.pyandtests/test_anim_rigs_join_index.py.Verified by OreoFR
3408969a7+ PR head08470ab71python -I tests/test_anim_rigs_join_index.pyAI-assisted (Claude Code, Claude Opus 5.5).
#1169 | head 08470ab71f2346bcb9963b23c1474ceed737fef5 (merged cleanly onto origin/main 818d881b1f) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes
Independent Verification (Windows 11)
tools/anim_rigs.pyandtests/test_anim_rigs_join_index.pyindexing cross-dictionary hashes once (all_keys = set().union(*keys.values()) if keys else set()) instead of rescanningkeys.values()per unresolved entry.python -I scripts/check_no_game_data.py tools/anim_rigs.py tests/test_anim_rigs_join_index.pypassed (rc=0).origin/main818d881b1fvs#1169 + origin/main):origin/main):join_rbf0on2,000dictionaries x20,000unmatched rig entries took1,678.3 ms.#1169 + origin/main): Identical output dictionary in80.0 ms(21.0xspeedup).python -I tests/test_anim_rigs_join_index.py->2/2passed (OK, including 50-iteration seeded random parity check againstreference(...)and2,000 x 20,000scale check)python -I tests/test_anim_rigs.py->15/15passed (OK)python -I tests/test_ci_registration.py->18/18passed (OK).Tested
08470ab71merged (no commit) withmainbd643e46e: Windows 11 10.0.26300, Python 3.12.4, CPU only.tests/test_anim_rigs_join_index.pygives 2 tests OK, andtests/test_anim_rigs.pygives 15 tests OK.tools/anim_rigs.pyback tomain, the new test still passes (2 tests in 2.5 s, against 0.3 s with the PR). It guards parity with a reference implementation, and the timing shows the gain.check_no_game_data.pyis clean.AI-assisted (Claude Code).
Tested
08470ab71merged (no commit) withmain4364a4fa6: Python 3.12, Windows 11 10.0.26300, CPU only.python -I tests/test_anim_rigs_join_index.pygives 2 tests OK with this PR, and also 2 OK withtools/anim_rigs.pyback tomain. No red: which case fails without the fix?AI-assisted (Claude Code).
Verified against
main:tools/anim_rigs.py:127-135(join_rbf0):keysis populated before the loop and never mutated inside it (keys.get(...)ande["source"] not in keysdo not triggerdefaultdict.__missing__), so precomputingall_keys = set().union(*keys.values()) if keys else set()and replacingany(h in k for k in keys.values())withh in all_keyspreserves exact counts across all cases (including emptykeysand unnamed dictionaries) while avoiding the O(entries * dicts) scan.tests/test_anim_rigs_join_index.py:1-66: pure stdlib, clean-room, and verified locally (tests/test_anim_rigs_join_index.py2/2 OK,tests/test_anim_rigs.py15/15 OK,scripts/check_no_game_data.pyclean).Holding merge for a fresh green CI run (
checkandmacos-pythonwere cancelled on the previous run).(AI-assisted review.)
Closing and reopening this so that CI runs again on the current
main. Nothing else changes, the head stays08470ab71. MoonEyes's agent.