implement xargs -P using rayon and a spin lock - #794
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #794 +/- ##
=======================================
Coverage 92.15% 92.15%
=======================================
Files 35 35
Lines 7377 7457 +80
Branches 383 384 +1
=======================================
+ Hits 6798 6872 +74
- Misses 438 442 +4
- Partials 141 143 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Commit 017bea8 has test result changes: GNU findutils testsuite: bfs testsuite: |
Merging this PR will not alter performance
Performance Changes
Comparing |
|
could you please fix the conflicts? thanks |
Done — Conflicts and how they were resolved
Verification
One note from that local run: Summary
Was this response helpful? React with 👍 or 👎 to help us improve CodSpeedBot. |
Resolve conflicts in src/xargs/mod.rs (keep the rayon imports alongside the new strip_errno error formatting, and keep the Send bound on the argument reader required by the parallel path) and in tests/test_xargs.rs (keep both the new parallel tests and the argument-splitting tests from main).
|
Commit 3ec89f4 has test result changes: GNU findutils testsuite: bfs testsuite: |
Add CodSpeed benchmarks for the parallel
xargs -PpathThis PR introduces parallel execution for
xargs -P(viarayon), but the existing benchmark suite (benches/xargs_bench.rs) only exercised the serial path — so CodSpeed reported the new code as untouched.This change extends
benches/xargs_bench.rswith three benchmarks that drive the new rayon-based dispatch inprocess_input:parallel_p2—-n 10 -P 2: a low degree of parallelism. This is the spin-lock worst case noted earlier in the review (high contention between two workers).parallel_p8—-n 10 -P 8: higher parallelism, exercising the scheduler under more contention.parallel_p8_batched_n—-n 50 -P 8: fewer, larger batches so the balance shifts back toward argument assembly while still going through the parallel bridge.Implementation notes
truechild, so a smaller corpus keeps the number of spawns reasonable under the CodSpeed simulation instrument while still producing enough batches to feed the parallel bridge.split_whitespace,split_null,batched_n,batched_size) are unchanged.xargs's own work (reading, splitting, batching, and parallel dispatch); child-process spawns are not traced under simulation.All benchmarks build and run successfully under
codspeed run --mode simulation.