Ticked Async Executor
Async Local Executor which executes woken tasks only when it is ticked
MSRV: 1.87
Usage
Default Local Executor
use *;
const DELTA: f64 = 1000.0 / 60.0;
let mut executor = default;
executor.spawn_local.detach;
// Tick your executor to run the tasks
assert_eq!;
executor.tick;
assert_eq!;
Split Local Executor
use *;
const DELTA: f64 = 1000.0 / 60.0;
let = default;
spawner.spawn_local.detach;
// Tick your ticker to run the tasks
assert_eq!;
ticker.tick;
assert_eq!;
Limit the number of woken tasks run per tick
use *;
const DELTA: f64 = 1000.0 / 60.0;
let mut executor = default;
executor.spawn_local.detach;
executor.spawn_local.detach;
// Runs upto 1 woken tasks per tick
assert_eq!;
executor.tick;
assert_eq!;
executor.tick;
assert_eq!;
Features
tick_eventtimer_registration
Tick Registration
Tick Event
Benchmarks
executor.spawn_local
Spawn 10000 tasks
time: [1.3711 ms 1.3713 ms 1.3715 ms]
executor.create_timer_from_timer_registrationunder featuretimer_registration
Spawn 1000 timers from timer registration
time: [336.10 µs 336.42 µs 336.93 µs]
executor.create_timer_from_tick_eventunder featuretick_event
Spawn 1000 timers from tick event
time: [1.5688 ms 1.5692 ms 1.5697 ms]
Caveats
- Uses the
smolecosystem - Ensure that tasks are spawned on the same thread as the one that initializes the executor
Roadmap
- TickedAsyncExecutor
- SplitTickedAsyncExecutor
- Similar to the channel API, but spawner and ticker cannot be moved to different threads
- Tracing