Skip to content

refactor: remove dedicated copy thread pool - #1901

Merged
max-sixty merged 1 commit into
mainfrom
fix/copy-pool-stale-comment
Apr 3, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/copy-pool-stale-comment

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The separate COPY_POOL (LazyLock<rayon::ThreadPool>) isolated copy I/O from the global rayon pool. In practice there's no concurrent rayon work during copies, so the isolation added complexity without benefit. This removes the pool, in_copy_pool(), and the copy_dir_recursive_inner indirection — copy operations now use the global rayon pool directly.

Follows #1894 which introduced the static pool.

This was written by Claude Code on behalf of @max-sixty

The separate COPY_POOL was preventing copy I/O from sharing the global
rayon pool, but there's no concurrent rayon work happening alongside
copies in practice. Removes the pool, in_copy_pool(), and the
copy_dir_recursive_inner indirection.

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 65c99c9 into main Apr 3, 2026
24 checks passed
@max-sixty
max-sixty deleted the fix/copy-pool-stale-comment branch April 3, 2026 14:06
max-sixty added a commit that referenced this pull request Apr 4, 2026
The global rayon pool (2× CPU cores, tuned for network I/O in `wt list`)
was being used for copy-ignored operations after #1901 removed the
dedicated pool. This caused ~1000% CPU usage on copy-heavy operations
that should be background work.

Restores a 4-thread `LazyLock` pool internal to `copy_dir_recursive`.
The public API is unchanged — no `in_copy_pool` wrapper needed since the
pool entry happens inside `copy_dir_recursive` itself.

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request Apr 4, 2026
#1901 removed the dedicated copy pool, so `copy_dir_recursive` started
using the global rayon pool (2× CPU cores, tuned for network I/O). This
caused ~1000% CPU on copy-heavy operations like `wt step copy-ignored`
with large `target/` directories.

Restores a 4-thread `LazyLock` pool internal to `copy_dir_recursive` —
no public API change needed. The pool is the same approach benchmarked
in #1721 (performance peaks at 2–4 threads for disk I/O).

> _This was written by Claude Code on behalf of @max-sixty_

Co-authored-by: Claude <[email protected]>
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.

2 participants