Skip to content

perf: run cache scanners alongside the project walk and parallelize walking and sizing - #72

Merged
ohing504 merged 10 commits into
mainfrom
perf/concurrent-scan
Oct 29, 2026
Merged

ohing504 merged 10 commits into
mainfrom
perf/concurrent-scan

Conversation

@ohing504

@ohing504 ohing504 commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

What changed

  • Stat scanners (global caches, Xcode, Docker, LLM stores) run alongside the project walk instead of after it.
  • fstree walks subdirectories in other goroutines when given slots; each directory hands its subdirectories their state (the project walk's context stack) instead of a shared stack with a Leave hook.
  • Sizing uses it with 8 process-wide slots, so one large artifact is sized by several goroutines.
  • The project walk uses it with 8 slots of its own.

Output is unchanged: results keep the same order and sizes.

Why

The cache lane (~21 s) waited for the project walk (~22–27 s), and each ran on one goroutine.

Result (warm cache)

Full home scan: 64–77 s → 28–35 s.

Docs

  • docs/ARCHITECTURE.md: pipeline step 1, sizing limit, § Shared traversal, § Walk engine.
  • No SPEC or decision change.

🤖 Generated with Claude Code

ohing504 and others added 4 commits October 28, 2026 22:12
…ge artifacts across workers

Stat scanners (global caches, Xcode, Docker, LLM stores) now run in a
second lane next to the project walk instead of after it, and measure
walks subdirectories of one artifact in parallel while one of 8
process-wide slots is free, so a lone large artifact such as a pnpm
store is no longer sized by one goroutine. Sub-walks share one
hard-link and clone tally, so totals are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fy lane code

- sizePending workers now wait for a slot of the same 8-slot limit the
  sub-walks take, so both lanes' pools and the sub-walks together run at
  most 8 sizing walks instead of up to 24.
- measure classifies a file before taking its lock once, instead of three
  lock sites and derived flags.
- ScanWithProgress keeps the first lane error with sync.Once instead of
  filtering context.Canceled afterwards, and names its progress counters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the walk and the stat scanners running together, the spinner kept
the name of the last stat scanner that started while the project walk
went on. Progress now names every lane still running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The project walk read every directory under the scan root with one
goroutine. A directory it would descend into is now handed to its own
goroutine, with a copy of the ancestors' project contexts, while one of
8 walk slots is free. Results are still sorted by (table order, path).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/concurrent-scan

# Conflicts:
#	internal/scanner/scanner.go
@ohing504 ohing504 changed the title perf: scan fixed cache paths alongside the project walk and split large artifacts across workers perf: 캐시 스캔을 프로젝트 탐색과 동시에 실행하고 큰 항목은 나눠서 크기 측정 Oct 29, 2026
@ohing504 ohing504 changed the title perf: 캐시 스캔을 프로젝트 탐색과 동시에 실행하고 큰 항목은 나눠서 크기 측정 perf: run cache scanners alongside the project walk and parallelize walking and sizing Oct 29, 2026
ohing504 and others added 4 commits October 29, 2026 22:26
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- cancel the other lane with context.WithCancelCause instead of a hand-rolled first error
- share one progress callback between the lanes
- bound sizing only by its slots and give the walk its own slot count
- state that Walker hooks must not modify a shared parent state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ohing504
ohing504 merged commit b6e83ac into main Oct 29, 2026
4 checks passed
@ohing504
ohing504 deleted the perf/concurrent-scan branch October 29, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant