gabriel / muse public
perf patch task/workspace-status-perf #1 / 1
gabriel · 167 days ago · Apr 14, 2026 · Diff

perf: parallelize workspace status and drop stash subprocess

list_workspace_members was sequential — each of N members paid for one muse status subprocess call plus a second muse stash list subprocess call. For 7 repos that was ~14 serial subprocesses ≈ 3.4 s wall time.

Two changes:

1. list_workspace_members dispatches _member_status calls concurrently via ThreadPoolExecutor(max_workers=N). Wall time is now bounded by the slowest single repo rather than the sum. Manifest order is preserved.

2. _member_status reads .muse/stash.json directly instead of spawning muse stash list --json. The stash file is a flat JSON list — a simple len() read with no subprocess overhead.

Result on a 7-member workspace: 3.35 s → 0.58 s (360% cpu confirms parallel execution).

Tests: 6 new cases covering parallelism (structural + wall-time), stash file read, empty stash, and absent stash file.

sha256:afbcfe92d64bf7e11ec8731e3288c4c975971d64dc3c4440834a0503d7be58a1 sha
+9 ~2 symbols
sha256:8c860aefa3dfa12d1ccab00fdc37a083a51d1895695c867abaf8d57ea364ac31 snapshot
+9
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 11 symbols
~ tests/test_core_workspace.py .py 9 symbols added
+ _make_present_repo function function _make_present_repo L183–193
+ inspect import import inspect L5–5
+ time import import time L8–8
+ test_list_workspace_members_runs_in_parallel function function test_list_workspace_members_runs_in_parallel L196–209
+ test_list_workspace_members_wall_time function function test_list_workspace_members_wall_time L263–284
+ test_stash_count_does_not_spawn_subprocess function function test_stash_count_does_not_spawn_subprocess L212–224
+ test_stash_count_read_from_file function function test_stash_count_read_from_file L227–241
+ test_stash_count_zero_when_file_absent function function test_stash_count_zero_when_file_absent L253–260
+ test_stash_count_zero_when_file_empty function function test_stash_count_zero_when_file_empty L244–250
← Older Oldest on task/workspace-status-perf
All commits
Newer → Latest on task/workspace-status-perf

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:afbcfe92d64bf7e11ec8731e3288c4c975971d64dc3c4440834a0503d7be58a1 --body "your comment"