[][src]Crate smolscale

A global, auto-scaling, preemptive scheduler based on async-executor.

smolscale is a fairly thin wrapper around a global [async-executor]. Unlike async-global-executor and friends, however, it has a preemptive thread pool that ensures that tasks cannot block other tasks no matter what. This means that you can do things like run expensive computations or even do blocking I/O within a task without worrying about causing deadlocks. Even with "traditional" tasks that do not block, this approach can reduce worst-case latency.

Furthermore, the thread pool is adaptive, using the least amount of threads required to "get the job done". This minimizes OS-level context switching, increasing performance in I/O bound tasks compared to the usual approach of spawning OS threads matching the number of CPUs.

Finally, this crate has seriously minimal dependencies, and will not add significantly to your compilation times.

This crate is heavily inspired by Stjepan Glavina's previous work on async-std.

Functions

spawn

Spawns a task onto the lazily-initialized global executor.