perf(runner): use 'wait -n' for parallel job slot on Bash 4.3+#671
Merged
Conversation
Add bashunit::runner::_supports_wait_n version probe. When supported, wait_for_job_slot blocks on next-child-exit instead of polling 'jobs -r' on a 50-200ms cadence. Bash 3.x keeps the existing adaptive-poll path. Eliminates sleep-induced wakeup latency on every released slot and cuts 'jobs -r | wc -l' subshell invocations. Closes #667
37aefe9 to
aa2b498
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bashunit::runner::_supports_wait_nversion probe.wait -n(4.3+),wait_for_job_slotblocks until any child exits instead of pollingjobs -ron a 50–200ms cadence.Why
jobs -r | wc -lsubshell invocations on the hot scheduling path.Test plan
tests/unit/parallel_test.shextended with:test_supports_wait_n_matches_running_bash_versiontest_wait_for_job_slot_releases_when_background_job_finishes(exercises both paths)./bashunit tests/unit/green (816 passed)./bashunit --parallel tests/green (1051 passed, 46s — was 48s baseline)make sacleanmake lintcleanCloses #667