feat(io_context): concurrency_hint heuristic and single_threaded tie-up#242
Conversation
|
An automated preview of the documentation is available at https://242.corosio.prtest3.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-05-06 00:05:47 UTC |
|
GCOVR code coverage report https://242.corosio.prtest3.cppalliance.org/gcovr/index.html Build time: 2026-05-06 00:11:25 UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #242 +/- ##
========================================
Coverage 77.71% 77.71%
========================================
Files 96 96
Lines 7298 7298
Branches 1787 1787
========================================
Hits 5672 5672
Misses 1108 1108
Partials 518 518
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Two related improvements to io_context construction:
1. Static heuristic for inline budget defaults: when concurrency_hint
> 1 and the user has not customized budget options, override
(init, max, unassisted) to (0, 0, 0). Multi-thread workloads
benefit from cross-thread work-stealing, which "post everything"
enables; single-thread keeps the (2, 16, 4) chaining defaults.
2. Tie concurrency_hint == 1 to single_threaded mode (asio precedent):
constructing an io_context with concurrency_hint == 1 now forces
opts.single_threaded = true, eliminating scheduler locking on the
hot path. Matches asio's one_thread_ behavior. To opt out, pass
concurrency_hint > 1.
Supporting changes:
- reactor_scheduler: short-circuit try_consume_inline_budget and
reset_inline_budget when inline_budget_max_ == 0 so post-everything
mode skips TLS-list walks; relax configure_reactor validation to
allow budget_max == 0; fix max(1, x) * 2 in ramp-up to escape zero.
- io_context: apply_options_pre_/post_ now take concurrency_hint;
new private configure_single_threaded_() helper used by the
bare-hint and template no-opts constructors.
- docs: update 4c2.configuration.adoc and io_context_options field
docs to describe the queue-empty gating and new defaults.
15302f5 to
b002c0e
Compare
Two related improvements to io_context construction:
Static heuristic for inline budget defaults: when concurrency_hint
Tie concurrency_hint == 1 to single_threaded mode (asio precedent): constructing an io_context with concurrency_hint == 1 now forces opts.single_threaded = true, eliminating scheduler locking on the hot path. Matches asio's one_thread_ behavior. To opt out, pass concurrency_hint > 1.
Supporting changes:
Benchmark Results
Results are statistically neutral for corosio_bench.
evpp
Summary: 19 wins, 5 ties, 0 losses (±1% threshold).