Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ name: CI

on:
push:
branches-ignore: [
# We don't need to run on renovate PRs.
"renovate/**",
# This is the branch the merge queue creates.
"gh-readonly-queue/**",
]
branches: [trunk]
pull_request:

env:
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
CI_RUST_VERSION: "1.85"
MSRV: "1.65"
MSRV: "1.71"

jobs:
build:
Expand Down Expand Up @@ -49,6 +44,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install cargo-nextest
uses: taiki-e/install-action@nextest

- name: install rust
shell: bash
run: |
Expand All @@ -68,7 +66,7 @@ jobs:
- name: test
shell: bash
if: matrix.name != 'stable wasm'
run: cargo test --all-features --target ${{ matrix.target }}
run: cargo nextest run --all-features --target ${{ matrix.target }}

msrv:
runs-on: ubuntu-latest
Expand All @@ -86,6 +84,13 @@ jobs:
rustup override set ${{ env.MSRV }}
cargo -V

- name: downgrade dependencies
run: |
set -e

# 2.12.0 bumps MSRV to 1.82.
cargo update -p indexmap --precise 2.11.0

- name: check msrv
run: |
set -e
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ and this project adheres to cargo's version of [Semantic Versioning](https://sem

## Unreleased

Released 2025-04-26
#### Changes
- MSRV updated to `1.71`.

## v0.3.1

Released 2025-04-26

#### Changes

- Updated dependencies.
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repository = "https://github.com/BVE-Reborn/switchyard"
license = "MIT OR Apache-2.0 OR Zlib"
keywords = []
categories = []
rust-version = "1.65"
rust-version = "1.71"

[[bench]]
name = "scheduling"
Expand All @@ -27,7 +27,7 @@ slotmap = "1"
affinity = "0.1.2"

[dev-dependencies]
async-std = "1.6"
tokio = { version = "1", features = ["rt-multi-thread"] }
criterion = "0.6"
flume = "0.11"
futures-executor = "0.3"
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ let yard = Switchyard::new(one_to_one(thread_info(), Some("thread-name")), || Ce
yard.spawn_local(0, |data| async move { data.set(10) });
```

## MSRV
1.65
## MSRV71

Future MSRV bumps will be breaking changes.

Expand Down
22 changes: 13 additions & 9 deletions benches/scheduling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ pub fn wide(c: &mut Criterion) {

group.throughput(Throughput::Elements(count as u64));

group.bench_function("async-std", |b| {
let rt = tokio::runtime::Runtime::new().unwrap();

group.bench_function("tokio", |b| {
b.iter_batched(
future_creation,
|input| {
let handle_vec: Vec<_> = input.into_iter().map(|fut| async_std::task::spawn(fut)).collect();
futures_executor::block_on(async move {
let handle_vec: Vec<_> = input.into_iter().map(|fut| rt.spawn(fut)).collect();
rt.block_on(async move {
for handle in handle_vec {
handle.await;
handle.await.unwrap();
}
})
},
Expand Down Expand Up @@ -60,24 +62,26 @@ pub fn chain(c: &mut Criterion) {

group.throughput(Throughput::Elements(count as u64));

group.bench_function("async-std", |b| {
let rt = tokio::runtime::Runtime::new().unwrap();

group.bench_function("tokio", |b| {
b.iter_batched(
|| {
let receiver = receiver.clone();
let mut head = async_std::task::spawn(async move {
let mut head = rt.spawn(async move {
receiver.recv_async().await.unwrap();
});
for _ in 0..count {
let old_head = head;
head = async_std::task::spawn(async move {
old_head.await;
head = rt.spawn(async move {
old_head.await.unwrap();
});
}
head
},
|input| {
sender.send(()).unwrap();
futures_executor::block_on(input)
rt.block_on(async { input.await.unwrap() })
},
BatchSize::PerIteration,
)
Expand Down