implement xargs -P using rayon and a spin lock - #653
Conversation
| batches | ||
| .par_bridge() | ||
| .map(|batch| batch?.execute_parallel(capacity).map_err(XargsError::from)) | ||
| .collect() |
There was a problem hiding this comment.
this is meat of the change, the other option here to avoid would be to build the thread pool directly which would avoid needing a lock but I feel the impl Iterator is a cleaner abstraction and is in line with rayon advice
61aae5c to
e175c3c
Compare
|
if more tests are desired then I have a branch ready to push |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #653 +/- ##
=======================================
Coverage 91.89% 91.90%
=======================================
Files 35 35
Lines 7217 7297 +80
Branches 376 377 +1
=======================================
+ Hits 6632 6706 +74
- Misses 442 446 +4
- Partials 143 145 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
e175c3c to
aa1ec44
Compare
|
Did you run some benchmark on it? |
|
here's a few ad-hoc rough numbers |
|
a few more that probably have more cpu contention |
|
@asakatida |
|
|
btw: |
|
Scenario 3 looks a little disappointing - Would be interesting to see how the performance compares against the implementation without the lock and without using multiple threads at all? (Just use one thread to spawn childs up to MAX_PROC and wait for any to finish) |
|
could you please rebase it? thanks |
aa1ec44 to
fd8d9c1
Compare
|
Commit fd8d9c1 has test result changes: GNU findutils testsuite: bfs testsuite: |
|
@codspeed add benchmarks |
|
Fails too many tests |
Added benchmarks covering the new parallel I added three benchmarks in
The parallel benchmarks use a smaller dedicated corpus (400 tokens vs. 4000 for the serial ones): each batch spawns a real All benchmarks build and run successfully under Summary
Was this response helpful? React with 👍 or 👎 to help us improve CodSpeedBot. |
if this is accepted then I could do #112 in a similar way