Commit Graph

116 Commits

Author SHA1 Message Date
John Nunley 2f3189a4b4
v1.9.0
Signed-off-by: John Nunley <dev@notgull.net>
2024-02-21 20:58:51 -08:00
James Liu c7bbe489ab
Use wrapping add on ticks to avoid tick counter overflow in debug builds (#101) 2024-02-22 13:03:49 +09:00
James Liu 7592d4188a
feat: Use actual thread local queues instead of using a RwLock
Currently, runner local queues rely on a RwLock<Vec<Arc<ConcurrentQueue>>>> to store the queues instead of using actual thread-local storage.

This adds thread_local as a dependency, but this should allow the executor to work steal without needing to hold a lock, as well as allow tasks to schedule onto the local queue directly, where possible, instead of always relying on the global injector queue.

Fixes #62

Co-authored-by: John Nunley <jtnunley01@gmail.com>
2024-02-21 19:53:40 -08:00
James Liu 188f976dc3
m: Weaken the atomic orderings for notification
The atomic orderings on State::notified might be too strong, as it's primarily
being used as a deterrent against waking up too many threads. This PR weakens
their sequentially consistent operations to Acquire/Release.
2024-02-17 12:20:57 -08:00
James Liu 568a314ad9
Avoid redundant lookups in the active slab when spawning new tasks (#96) 2024-02-17 17:02:59 +09:00
James Liu 7ffdf5ba92
m: Replace unnecessary atomics with non-atomic operations 2024-02-16 17:22:43 -08:00
Jacob Rothstein 0baba46152
chore: Bump async-task to v4.4.0
this crate depends on async_task::Builder, which was introduced in 4.4.0
2024-02-12 19:40:56 -08:00
dependabot[bot] 4fbe23af69
Update criterion requirement from 0.4 to 0.5 (#43)
Signed-off-by: dependabot[bot] <support@github.com>
2024-01-27 00:34:45 +09:00
John Nunley 6c70369102
ex: Use Semaphore instead of manual event-listener
Whoops, I accidentally reinvented a semaphore and made the example a lot
more complicated than it needed to be.

Signed-off-by: John Nunley <dev@notgull.net>
2024-01-08 16:01:07 -08:00
Taiki Endo 57fcc2d991 Relax MSRV to 1.60
https://github.com/smol-rs/futures-lite/pull/90
2024-01-07 07:07:37 +09:00
Taiki Endo 24510a7b72 ci: Use cargo-hack's --rust-version flag for msrv check
This respects rust-version field in Cargo.toml, so it removes the need
to manage MSRV in both the CI file and Cargo.toml.
2024-01-07 07:07:37 +09:00
John Nunley d747bcd827
v1.8.0
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-24 08:21:32 -08:00
John Nunley fa117dee27
Propagate panics in tasks (#78)
After smol-rs/async-task#37 I meant to add this to the executor. This
commit makes it so all panics are surfaced in the tasks that the user
calls. Hopefully this improves ergonomics.

Signed-off-by: John Nunley <dev@notgull.net>
Signed-off-by: Alain Zscheile <fogti+devel@ytrizja.de>
2023-11-21 11:39:09 +01:00
John Nunley 4b1cf40142
v1.7.2
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-18 09:26:16 -08:00
John Nunley 144b0576d1 Update to 2021 edition
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-13 08:30:50 -08:00
John Nunley b140c46123 Fix dev-dependency WASM compilation issue
`futures-lite` in the dev dependencies added a `block_on` call that was
not present in the WASM build, causing a compile error. This PR makes
sure that the `std` feature of `futures-lite` is enabled in Cargo.toml.

This also adds a CI check to ensure that this doesn't happen again

Signed-off-by: John Nunley <dev@notgull.net>
2023-11-13 08:30:50 -08:00
John Nunley 1d4769a7b5
v1.7.1
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-12 16:21:46 -08:00
John Nunley 6c3d45b23c
bugfix: Fix wasm32 compile errors
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-11 10:15:04 -08:00
John Nunley f076528d27
Add a disclaimer saying this is a basic executor (#74)
In many issues I've mentioned that the executors in this crate are just
reference executors. However, this is not documented in the crate
itself.

This commit adds a disclaimer to the crate documentation and to
README.md that these are reference executors that shouldn't be relied on
for performance.

Signed-off-by: John Nunley <dev@notgull.net>
2023-11-11 08:34:46 -08:00
John Nunley c7fd967c9e
v1.7.0
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-05 17:24:42 -08:00
John Nunley 361c5fd359 Fix missing import on Miri
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-02 21:50:48 -07:00
John Nunley 457cf7b888 Disable leaky test for MIRI
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-02 21:50:48 -07:00
John Nunley e1e2ab11df Bump async-io, async-lock and futures-lite
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-02 21:50:48 -07:00
dependabot[bot] b91875e73b
deps: Update async-channel requirement from 1.4.1 to 2.0.0
Updates the requirements on [async-channel](https://github.com/smol-rs/async-channel) to permit the latest version.
- [Release notes](https://github.com/smol-rs/async-channel/releases)
- [Changelog](https://github.com/smol-rs/async-channel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/async-channel/compare/v1.4.1...v2.0.0)

---
updated-dependencies:
- dependency-name: async-channel
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-30 20:54:02 -07:00
John Nunley 599c71a3f9
v1.6.0
Signed-off-by: John Nunley <dev@notgull.net>
2023-10-16 19:17:27 -07:00
John Nunley 8a0832c090
m: Remove the thread-local executor optimization
This was added in #37 as an optimization, but has since lead to many bugs. See
the issues #53, #57 and #60 for more information. I do not have the bandwidth
to address all of these bugs, so I'm taking the path of least resistance by
just removing the problematic code.

CLoses #53, #57 and #60

Signed-off-by: John Nunley <dev@notgull.net>
2023-10-16 18:50:00 -07:00
John Nunley 917caad8b9
ex: Add an example of an executor with limited tasks
Signed-off-by: John Nunley <dev@notgull.net>
2023-10-15 19:26:22 -07:00
John Nunley 2cfb6e4ed0
v1.5.4
Signed-off-by: John Nunley <dev@notgull.net>
2023-09-27 21:17:03 -07:00
John Nunley 4154ad2190
Fix a bug where TLS would become None (#55)
* Fix a bug where TLS would become None

The bug is invoked as follows:

- Runner 1 is created and stores the current version of the TLS
  LOCAL_QUEUE variable, which is None.
- Runner 2 is also created. It stores the current version of the TLS
  variable as well, which is Runner 1's queue.
- Runner 1 is dropped. It stores None into the LOCAL_QUEUE variable.
- Runner 2 tries to run. It reads from the LOCAL_QUEUE variable, sees
  that it is None, and panics.

This could be solved by just not using the local queue if the variable
is None. However, we can do one better; if the slot is open, we can
optimize the runner by replacing it with our own queue. This should
allow for the local queue to be used more often.

Closes #54

Signed-off-by: John Nunley <dev@notgull.net>
2023-09-27 20:01:15 -07:00
John Nunley 77b5b169c5
v1.5.3
Signed-off-by: John Nunley <dev@notgull.net>
2023-09-25 09:52:25 -07:00
John Nunley ecddfde87a
m: Remove unused memchr dependency
Signed-off-by: John Nunley <dev@notgull.net>
2023-09-23 11:01:56 -07:00
Taiki Endo ff67cb9a5f Update actions/checkout action to v4 2023-09-10 18:18:02 +09:00
Taiki Endo 609aafb330 Bump MSRV to 1.61
```
error: package `memchr v2.6.3` cannot be built because it requires rustc 1.61 or newer, while the currently active rustc version is 1.60.0
```
2023-09-05 00:49:20 +09:00
John Nunley a5ff8df7d9
bugfix: Ensure that ex.run() produces a Send future
This commit makes sure that the run() and tick() functions produce
futures that are Send and Sync, to prevent a regression introduced in
PR #37. Tests are also added to prevent this regression in the future.

Signed-off-by: John Nunley <dev@notgull.net>
2023-08-20 17:08:35 -07:00
John Nunley e19573367b
v1.5.2
Signed-off-by: John Nunley <dev@notgull.net>
2023-08-19 19:17:39 -07:00
John Nunley aed7279805
Add smol-rs logo (#46) 2023-07-17 14:35:07 +09:00
John Nunley 9df3dd4974
alg: Push tasks directly to the local runner
This commit adds an optimization where a thread-local variable contains the queue of the
current runner. Rather than pushing to the global queue and hoping that a local queue
eventually picks it up, tasks are pushed directly to this local queue if available.

This has led to speedups of up to 70% in some cases and up to 10% in other workloads.
2023-07-02 11:29:19 -07:00
John Nunley 1a9e08ce73
Use fastrand v2.0.0 (#45) 2023-06-09 17:53:03 -07:00
Yosh 85c20eb98b
Replace `num_cpus` crate with `std::thread` (#42) 2023-05-05 21:38:00 +09:00
Taiki Endo 8562c41062 Update permissions for security_audit 2023-04-10 02:35:44 +09:00
John Nunley a438e9da8c
v1.5.1 (#40) 2023-04-07 11:01:23 -07:00
John Nunley 6aba704efc
bench: Add benchmarks for lower thread counts (#38) 2023-03-10 19:18:48 -08:00
Taiki Endo b8885f9578 Bump MSRV to 1.48
async-lock 2.7.0 requires Rust 1.48.

```
error[E0658]: use of unstable library feature 'future_readiness_fns'
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/async-lock-2.7.0/src/once_cell.rs:430:45
    |
430 |             self.initialize_or_wait(move || std::future::ready(closure()), &mut Blocking),
    |                                             ^^^^^^^^^^^^^^^^^^
    |
```
2023-03-06 01:43:03 +09:00
Taiki Endo ddfb54d1c4 Minimize GITHUB_TOKEN permissions
Refs: https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token
2023-03-04 11:41:08 +09:00
Taiki Endo 4d8e7bad23 Set CARGO_NET_GIT_FETCH_WITH_CLI=true in CI 2023-03-04 11:41:08 +09:00
John Nunley a988ee3e46
m: Migrate benchmarks to criterion (#35)
* m: Migrate to criterion

* Update CI
2023-01-23 11:30:43 -08:00
Taiki Endo f196463b09 Enable dependabot update for Rust 2022-12-28 12:27:06 +09:00
Taiki Endo b48a503109 Clean up CI config 2022-12-28 12:27:06 +09:00
John Nunley 8287e520b9
Implement debug output to be better (#33) 2022-12-25 07:12:59 -08:00
Taiki Endo 00ea6cf6a1 Release 1.5.0 2022-11-09 11:45:41 +09:00