Skip to content

implement xargs -P using rayon and a spin lock - #794

Open
codspeed-hq[bot] wants to merge 2 commits into
mainfrom
push-zlxwkxlkpsls
Open

implement xargs -P using rayon and a spin lock#794
codspeed-hq[bot] wants to merge 2 commits into
mainfrom
push-zlxwkxlkpsls

Conversation

@codspeed-hq

@codspeed-hq codspeed-hq Bot commented Jul 26, 2026

Copy link
Copy Markdown

Add CodSpeed benchmarks for the parallel xargs -P path

This PR introduces parallel execution for xargs -P (via rayon), 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.rs with three benchmarks that drive the new rayon-based dispatch in process_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

  • The parallel benchmarks use a smaller dedicated corpus (400 tokens) than the serial ones (4000). Each batch spawns a real true child, 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.
  • The serial benchmarks (split_whitespace, split_null, batched_n, batched_size) are unchanged.
  • Measurements are dominated by 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.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.38843% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.74%. Comparing base (f38dbe5) to head (017bea8).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/xargs/mod.rs 93.38% 5 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #794      +/-   ##
==========================================
+ Coverage   91.89%   92.74%   +0.85%     
==========================================
  Files          35       35              
  Lines        7217     7751     +534     
  Branches      376      461      +85     
==========================================
+ Hits         6632     7189     +557     
+ Misses        442      419      -23     
  Partials      143      143              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown

Commit 017bea8 has test result changes:

GNU findutils testsuite:

Test results comparison:
  Current:   TOTAL: 495 / PASSED: 413 / FAILED: 81 / SKIPPED: 1
  Reference: TOTAL: 495 / PASSED: 417 / FAILED: 77 / SKIPPED: 1

Changes from main branch:
  TOTAL: +0
  PASSED: -4
  FAILED: +4

New test failures (4):
  - idef-s26-0
  - s14
  - s14-0
  - s42

bfs testsuite:

Test results comparison:
  Current:   TOTAL: 314 / PASSED: 267 / FAILED: 41 / SKIPPED: 6
  Reference: TOTAL: 314 / PASSED: 267 / FAILED: 41 / SKIPPED: 6

New test failures (1):
  - gnu/files0_from_ok

Test improvements (1):
  + gnu/okdir_path_empty

@codspeed-hq

codspeed-hq Bot commented Jul 26, 2026

Copy link
Copy Markdown
Author

Merging this PR will not alter performance

✅ 20 untouched benchmarks
🆕 3 new benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 parallel_p2 N/A 62.9 ms N/A
🆕 parallel_p8 N/A 9.4 ms N/A
🆕 parallel_p8_batched_n N/A 2.5 ms N/A

Comparing push-zlxwkxlkpsls (017bea8) with main (3f9926c)

Open in CodSpeed

@codspeed-hq
codspeed-hq Bot marked this pull request as ready for review July 26, 2026 18:23
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