A meaningless comparison. Linux, being a preemptively multitasking OS, switches thread contexts regardless of what you're running. So the Rust async context switch is on top of the regular Linux context switch, not instead .
Comparison of Rust async and Linux thread context switch time and memory use
51–60 of 201 posts
Re: Comparison of Rust async and Linux thread context switch time and memory use
#52Quickest summary: Rust async is >3x faster and lighter than Linux threads. This is a great accomplishment for Rust.
Re: Comparison of Rust async and Linux thread context switch time and memory use
#53That's a huge help. I only need about 20 threads in Rust, some of which are compute-bound. So involving "async" is totally the wrong tool for the job. Goodbye, Tokio.
> So involving "async" is totally the wrong tool for the job. Sadly with so many things having gone async-first (or only) it’s become difficult not to end up with an async runtime anyway, or not be forced to use an async system. I wanted to build a small web-based tool for local, didn’t really find anything which was not async.
Re: Comparison of Rust async and Linux thread context switch time and memory use
#54Earlier quoted context omitted.
Then why is it that IO-heavy benchmarks such as the Techempower web benchmark are dominated by async frameworks? The fastest results there are all from async frameworks [1]. And among Rust frameworks the same pattern holds. The fastest Rust frameworks are async while a synchronous frmework such as Rocket is about 20x slower. [1] https://www.techempower.com/benchmarks/#section=data-r20&hw=... [2] https://www.techempow…
Those benchmarks measure one very specific scenario: serving lots of small requests concurrently. Async handles that well because that's exactly the scenario where a single epoll_wait() call will return lots of events.
Re: Comparison of Rust async and Linux thread context switch time and memory use
#55> But this advantage goes away if the context switch is due to I/O readiness This is not at all a fair comparison unless you're using io_uring.
Re: Comparison of Rust async and Linux thread context switch time and memory use
#56Re: Comparison of Rust async and Linux thread context switch time and memory use
#57Re: Comparison of Rust async and Linux thread context switch time and memory use
#58Please don't mix nanoseconds and microseconds. This is just confusing to read. Stick to nanoseconds for everything.
ah, a fellow traveler - godspeed. what a sane, reasonable world we could have if nanosecond timestamps ruled supreme.