70 Commits
Author SHA1 Message Date
linkmauveandGitHub d5950a8890 refactor: fix variable name typos (#8267) 2026-07-10 20:53:52 +02:00
Charlie TonneslanandGitHub 467d614267 bench: use is_multiple_of instead of manual modulo check (#7984)
Addresses clippy::manual_is_multiple_of warning on latest stable.
2026-03-22 14:00:12 +01:00
Alex GaynorandGitHub ee04abe797 bench: add remote_spawn benchmark for inject queue contention (#7944) 2026-03-11 10:13:39 +01:00
Alex GaynorandGitHub be99e7aa04 benches: add spawn_blocking concurrency benchmark (#7748) 2025-12-03 10:20:50 +01:00
Aaron ChenandGitHub a7896d07f1 chore: update CI to clippy 1.88 (#7452) 2025-07-09 08:34:24 +02:00
Alice RyhlandGitHub 2506c9fa99 benches: revert "properly gate unix benches" (#7412)
This reverts commit 933fa498d0.
2025-06-21 14:52:04 +02:00
Tim Vilgot Mikael FredenbergandGitHub 933fa498d0 benches: properly gate unix benches (#7392) 2025-06-11 10:07:34 +02:00
Jeff Vander StoepandGitHub 193c1574a1 examples: update rand crate to 0.9.1 (#7371) 2025-05-28 11:32:24 +00:00
Nicholas SkinsacosandGitHub 964fd06e0f benches: add helper functions for building runtimes (#7260) 2025-04-14 12:23:00 +03:30
Taiki EndoandGitHub 7f09959b0a chore: use [lints] to address unexpected_cfgs lint (#7124) 2025-01-25 17:46:21 +01:00
Hamir MahalandGitHub d4178cf349 tokio: avoid positional fmt params when possible (#6978) 2024-11-18 13:50:58 +01:00
Alice RyhlandGitHub ebe241647e ci: use cargo deny (#6931) 2024-10-23 18:48:07 +02:00
Tim Vilgot Mikael FredenbergandGitHub feb742c58e chore: replace num_cpus with available_parallelism (#6709) 2024-07-22 23:15:23 +02:00
Michael ScholtenandGitHub daa89017da ci: fix new clippy warnings (#6569) 2024-05-18 10:09:37 +02:00
Weijia JiangandGitHub f6eb1ee196 time: lazily init timers on first poll (#6512) 2024-05-03 15:37:52 +02:00
M.Amin RayejandGitHub bb25a06f34 chore: fix dead code warnings (#6423) 2024-03-22 13:44:18 +03:30
e392c4ff1e chore: update CI to clippy 1.76 (#6334)
Co-authored-by: Rafael Bachmann <[email protected]>
2024-02-10 10:45:40 +01:00
Sergei FominandGitHub 7536132065 sync: use AtomicBool in broadcast channel future (#6298) 2024-01-27 18:52:55 +00:00
Alice RyhlandGitHub 52f28dcb4f benches: fix benchmarking conflicts for real this time (#6246) 2023-12-28 09:52:18 +00:00
Alice RyhlandGitHub 7cae89af47 benches: fix benchmarking conflicts (#6243) 2023-12-22 22:43:05 +00:00
4aa7bbff4c chore: typo fixes (#6213)
Co-authored-by: kwfn <[email protected]>
2023-12-11 19:22:55 +00:00
Weijia JiangandGitHub 3a4aef17b2 runtime: reduce the lock contention in task spawn (#6001) 2023-12-07 10:45:07 +00:00
Aaron SchweigerandGitHub 881b510a07 sync: add mpsc::Receiver::recv_many (#6010) 2023-10-17 11:01:41 +02:00
Tymoteusz WiśniewskiandGitHub ca89c5b2ec benches: move sender to a spawned task in watch benchmark (#6034) 2023-09-28 11:28:12 +02:00
M.Amin RayejandGitHub b046c0dcbb benches: use criterion instead of bencher (#5981) 2023-09-10 16:42:53 +02:00
Taiki EndoandGitHub af6c87a045 chore: upgrade remaining 2018 edition crates to 2021 edition (#5788) 2023-06-12 02:21:50 +09:00
Carl LercheandGitHub 79a7e78c0d rt(threaded): basic self-tuning of injection queue (#5720)
Each multi-threaded runtime worker prioritizes pulling tasks off of its
local queue. Every so often, it checks the injection (global) queue for
work submitted there. Previously, "every so often," was a constant
"number of tasks polled" value. Tokio sets a default of 61, but allows
users to configure this value.

If workers are under load with tasks that are slow to poll, the
injection queue can be starved. To prevent starvation in this case, this
commit implements some basic self-tuning. The multi-threaded scheduler
tracks the mean task poll time using an exponentially-weighted moving
average. It then uses this value to pick an interval at which to check
the injection queue.

This commit is a first pass at adding self-tuning to the scheduler.
There are other values in the scheduler that could benefit from
self-tuning (e.g. the maintenance interval). Additionally, the
current-thread scheduler could also benfit from self-tuning. However, we
have reached the point where we should start investigating ways to unify
logic in both schedulers. Adding self-tuning to the current-thread
scheduler will be punted until after this unification.
2023-06-01 08:13:24 -07:00
Carl LercheandGitHub 3a94eb0893 rt: batch pop from injection queue when idle (#5705)
In the multi-threaded scheduler, when there are no tasks on the local
queue, a worker will attempt to pull tasks from the injection queue.
Previously, the worker would only attempt to poll one task from the
injection queue then continue trying to find work from other sources.
This can result in the injection queue backing up when there are many
tasks being scheduled from outside of the runtime.

This patch updates the worker to try to poll more than one task from the
injection queue when it has no more local work. Note that we also don't
want a single worker to poll **all** tasks on the injection queue as
that would result in work becoming unbalanced.
2023-05-23 08:16:41 -07:00
Carl LercheandGitHub 93bde0870f rt: use task::Inject with current_thread scheduler (#5702)
Previously, the current_thread scheduler used its own injection queue
instead of sharing the same one as the multi-threaded scheduler. This
patch updates the current_thread scheduler to use the same injection
queue as the multi-threaded one (`task::Inject`).

`task::Inject` includes an optimization where it does not need to
acquire the mutex if the queue is empty.
2023-05-21 00:08:00 +00:00
Tymoteusz WiśniewskiandGitHub db543639e1 sync: reduce contention in Notify (#5503) 2023-04-19 13:07:10 +02:00
Carl LercheandGitHub ee1c940709 time: Improve Instant::now() perf with test-util (#5513)
The test-util feature flag is only intended to be used with tests.
However, it is possible to enable it in release mode accidentally. This
patch reduces the overhead of `Instant::now()` when the `test-util`
feature flag is enabled but `time::pause()` is not called.

The optimization is implemented by adding a static atomic flag that
tracks if `time::pause()` has ever been called. In `Instant::now()`, the
atomic flag is first checked before the thread-local and mutex are
accessed.
2023-02-27 10:21:42 -08:00
tijsvdandGitHub d7abdbb315 benches: mutex contention in watch::Receiver bench (#5472) 2023-02-18 14:51:08 +00:00
Christopher HuntandGitHub e106c4d32b benches: benchmark for things in block_on (#5440)
This additional benchmark exercises a common request/reply pattern using an MPSC for requests along with a oneshot payload as a reply mechanism. When used in a current threaded scenario, the bench is 17 times faster on my machine than when using the multi-threaded runtime and one worker thread. Not only that, but if I increase the number of worker threads to 6, performance degrades further.

Does this suggest a scheduling problem with the multi-threaded runtime?

No matter what, hopefully the benchmarks are a useful addition.
2023-02-14 23:05:10 +00:00
Simon FarnsworthandGitHub 6bdcb813c6 io: make copy continue filling the buffer when writer stalls (#5066) 2022-10-03 12:58:21 +02:00
xxchanandGitHub ff6fbc327d sync: add #[must_use] to lock guards (#4886) 2022-08-09 13:44:29 +02:00
Toby LawrenceandGitHub 4b6bb1d9a7 chore(util): start v0.7 release cycle (#4313)
* chore(util): start v0.7 release cycle

Signed-off-by: Toby Lawrence <[email protected]>
2021-12-10 13:16:17 -05:00
Taiki EndoandGitHub fe770dc509 chore: fix newly added warnings (#4253) 2021-11-22 18:40:57 +09:00
Alice RyhlandGitHub 51fad066e2 bench: update spawn benchmarks (#3927) 2021-07-07 10:52:53 +02:00
Taiki EndoandGitHub 08ed41f339 chore: fix typos (#3907) 2021-07-01 02:06:56 +09:00
Taiki EndoandGitHub 17c7ce616c benches: fix build error (#3769) 2021-05-09 22:26:20 +09:00
Stefan SydowandGitHub 177522cd43 benchmark: add file reading benchmarks (#3013) 2021-05-05 21:49:00 +02:00
Lucio FrancoandGitHub 8efa62013b Move stream items into tokio-stream (#3277)
This change removes all references to `Stream` from
within the `tokio` crate and moves them into a new
`tokio-stream` crate. Most types have had their
`impl Stream` removed as well in-favor of their
inherent methods.

Closes #2870
2020-12-15 20:24:38 -08:00
Carl LercheandGitHub 473ddaa277 chore: prepare for Tokio 1.0 work (#3238) 2020-12-09 09:42:05 -08:00
Carl LercheandGitHub 97c2c4203c chore: automate running benchmarks (#3140)
Uses Github actions to run benchmarks.
2020-11-13 19:30:52 -08:00
07802b2c84 rt: worker_threads must be non-zero (#2947)
Co-authored-by: Alice Ryhl <[email protected]>
2020-10-12 15:15:40 -04:00
8880222036 rt: Remove threaded_scheduler() and basic_scheduler() (#2876)
Co-authored-by: Alice Ryhl <[email protected]>
Co-authored-by: Carl Lerche <[email protected]>
2020-10-12 13:44:54 -04:00
Mikail BagishovandGitHub 99d4061203 bench: fix unused_mut lint in benches (#2889) 2020-09-27 11:07:55 +02:00
Ivan PetkovandGitHub 7ae5b7bd4f signal: move driver to runtime thread (#2835)
Refactors the signal infrastructure to move the driver to the runtime
thread. This follows the model put forth by the I/O driver and time
driver.
2020-09-22 15:40:44 -07:00
d600ab9a8f rt: Refactor Runtime::block_on to take &self (#2782)
Co-authored-by: Eliza Weisman <[email protected]>
2020-08-27 20:05:48 -04:00
Carl LercheandGitHub 6ccefb77e2 chore: prepare for v0.3 breaking changes (#2747)
Bug fixes will be applied to the v0.2.x branch.
2020-08-07 20:27:53 -07:00