gabriel / muse public
perf patch task/perf-branch-stash #1 / 1
gabriel · 166 days ago · Apr 14, 2026 · Diff

perf: pre-compute branch ancestor set once; stash uses has_object

branch.py: _commit_ancestors was called once per branch inside _passes, rebuilding the full ancestor DAG of 'into' from scratch each time. With N branches, --merged did O(N × commits) reads. Pre-compute the ancestor set once before the filter loop: O(commits) reads total.

stash.py: _verify_manifest_objects called read_object() (loads full bytes) to check existence. Replace with has_object() (path stat only).

Tests (TDD): TestStress::test_merged_filter_ancestor_set_computed_once, TestStashPerf (2 tests: structural + behavioral).

sha256:9dcb396cb3fad0e9d6b656be2d96d029cafc3da1c9740a81184a115e8d4e0524 sha
+5 ~5 symbols
sha256:96eea3948b3e73d8c5e398979150a3e8541b33d79e42902e12384b040b2d9fa8 snapshot
+5
symbols added
~5
symbols modified
0
dead code introduced
Semantic Changes 10 symbols
~ muse/cli/commands/branch.py .py 1 symbol modified
~ run
~ muse/cli/commands/stash.py .py 1 symbol added, 3 symbols modified
+ has_object import import has_object L49–49
~ tests/test_cmd_branch.py .py 1 symbol added, 1 symbol modified
+ test_merged_filter_ancestor_set_computed_once method method test_merged_filter_ancestor_set_computed_once L878–911
~ tests/test_cmd_stash.py .py 3 symbols added
+ TestStashPerf class class TestStashPerf L480–538
+ test_verify_manifest_calls_has_object_not_read_object method method test_verify_manifest_calls_has_object_not_read_object L501–538
+ test_verify_manifest_uses_has_object_not_read_object method method test_verify_manifest_uses_has_object_not_read_object L483–499
← Older Oldest on task/perf-branch-stash
All commits
Newer → Latest on task/perf-branch-stash

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:9dcb396cb3fad0e9d6b656be2d96d029cafc3da1c9740a81184a115e8d4e0524 --body "your comment"