Skip to content

refactor: replace Mutex-based error collection with lock-free patterns - #2946

Merged
oferchen merged 1 commit into
masterfrom
refactor/lock-free-error-collection
Mar 22, 2026
Merged

oferchen merged 1 commit into
masterfrom
refactor/lock-free-error-collection

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Replace Arc<Mutex<Vec<(usize, io::Error)>>> error collection in ParallelExecutor and ParallelFileOps with rayon native fold/reduce pattern
  • Each rayon work-stealing thread accumulates successes and errors into thread-local vectors, then merges them in the reduce step - zero lock contention
  • Remove Arc and Mutex imports from crates/fast_io/src/parallel.rs entirely
  • AtomicU64 for byte tracking in process_files no longer needs Arc wrapping since it lives on the stack and the closure borrows it by reference

Test plan

  • Existing executor_process_basic, executor_handles_errors, executor_copy_files, and stats_tracking tests pass unchanged
  • CI: fmt, clippy, nextest on all platforms

@oferchen
oferchen merged commit 890668a into master Mar 22, 2026
5 of 10 checks passed
@oferchen
oferchen deleted the refactor/lock-free-error-collection branch March 22, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant