Dyon uses a Go-like model for concurrency. However, until now this used one OS thread per co-routine.
Since it is expensive to swap between threads in the OS, this becomes a bottleneck.
Async code in Rust makes it possible to execute thousands of tasks in parallel at much higher performance, using an executor runtime like Tokio.
Example
This example sums the first 10 000 natural numbers, creating a task for each number:
See https://github.com/PistonDevelopers/dyon/issues/741
Compiled behind Cargo feature: "async"
To compile the "dyonrun" example with async:
cargo build --release --features="async" --example dyonrun
Why async?
Dyon uses a Go-like model for concurrency. However, until now this used one OS thread per co-routine. Since it is expensive to swap between threads in the OS, this becomes a bottleneck.
Async code in Rust makes it possible to execute thousands of tasks in parallel at much higher performance, using an executor runtime like Tokio.
Example
This example sums the first 10 000 natural numbers, creating a task for each number:
test.dyon
On my laptop: Without async (default):
3.15s user 1.82s system 118% cpu 4.185 total
With async:0.06s user 0.02s system 155% cpu 0.057 total