perf
log
main
#32 / 100
perf(log): stop commit walk early when no filters are active
get_commits_for_branch accepted no limit, so every muse log invocation read every commit JSON file off disk before log.py sliced the result to --max-count. On a repo with 200 commits, muse log -n 10 was opening 200 files to show 10.
Add max_count parameter (0 = unbounded, preserves all existing callers). log.py passes limit as walk_limit when no filters (--since/--until/ --author/--section/--track/--emotion) are active. With filters the walk stays unbounded because commits may be skipped and the filter loop enforces the limit itself.
The 'brief moment' on cold repos is Python startup (~100ms). The walk optimisation eliminates the per-commit file-open cost that compounds on repos with many commits.
2
files changed
406
files in snapshot
Files Changed
406 in snapshot
~2
No comments yet. Be the first to start the discussion.