Repository navigation
perf(runtime): adaptive yield budget for idle pool workers - #44
Draft
nicolas-abril wants to merge 1 commit into
Draft
nicolas-abril wants to merge 1 commit into
nicolas-abril wants to merge 1 commit into
Conversation
… its gaps A worker waiting for the next pool turn yielded 128 times (some 300us) before sleeping, so a program whose turns come between long serial parts paid a core's worth of sched_yield calls per worker per gap. Its budget now halves after a wait that slept (down to 4) and doubles after one the yields ended (up to 128): short gaps keep spinning, long ones stop. A fixed lower count was tried first: 4 lost up to 58% wall on seam-carve-index, 32 still lost 11% there and 8% on ocaml-lu-decomp. The hunters' wait (fk_help) is unchanged; shortening it lost more. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 44b5f4b)
nicolas-abril
force-pushed
the
opt/pool-park
branch
from
December 1, 2026 21:55
44b5f4b to
65f9bc6
Compare
nicolas-abril
added a commit
that referenced
this pull request
Dec 1, 2026
…33, #34, #36, #39, #44, #61-#68): record their heads Each is a port onto main of integration's own branch, its content already here (integration keeps the original commits; the ports add type fixes, line wraps, moved pieces and #68's book_passes, applied in the previous commit). Groups: #61 (#9 #11 #15 #32 #41 #42), #62 (#26 #56), #63 (#48 #50 and compile-time), #64 (#19 #20 #45), #67 (#55 #58), #68 (#54); par-defer (#43) is now part of #34, lazy-startup's parts are in #16 and #34. This merge records their heads (-s ours: no content change). Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
On main (
6180be5b)This PR is a port onto main, on
main: 1 commit of its own, with no integration history (head65f9bc6b).Port notes
pool_turn's wait loop for perf(rt): a hungry drain splits the oldest fork a sequential task has open #34's fork hunters is left out (that is perf(rt): a hungry drain splits the oldest fork a sequential task has open #34's code).Checks
run/array_slabfails on main too).ttok -m gpt-3.5-turbo) over main, which is at 65,989 of the 66,000 cap.Performance was measured on integration when this change merged there (see the original description or the replaced PRs); it has not been re-measured on main.
Original description (written for integration)
Based on
opt/integration(3024810); the diff againstmainincludes the integration branch.What
An idle pool worker waiting for the next turn yielded 128 times (about 300 µs) before it slept on
pool_wake. A program whose parallel turns sit between long serial parts therefore paid a core's worth ofsched_yieldcalls per worker per gap: in a 10-thread profile of the tar decoder, yields (swtch_pri) were about 24% of all samples.Each worker's yield budget now adapts:
Short gaps keep spinning, and long ones stop spinning after a few turns. The main thread's join wait keeps a fixed budget of 128.
Tried and rejected
fk_help(4096 → 128 tries)Measurements
All 98 parallel ports (
parallel-ml/,osprey/*/bend-par/), run on the cluster at 10 threads with 11 interleaved reps each, A and B on the same node. The first (cold) rep is dropped and the median is taken.Tar decoder (local, 10 threads, 7 reps): same wall time, user+sys CPU −6% to −12% across five archives.
Tests: all 1958 tests with expected output, on the cluster lane (run, plus the memory check at 1 and 8 threads). Statuses and live-word counts are identical to integration.
comp.ts: +161 ttok (102,364 → 102,525).
🤖 Generated with Claude Code