News for hackers. Stuff that matters.
Re:The Size of Rust Futures by Matthias247 on Friday January 27, 2023 @08:05PM (#34553987)
I think I might have been the first person who reported this in 2019: https://github.com/rust-lang/rust/issues/59087

It’s a pretty interesting problem. While everyone assumed that futures are lightweight and thereby more efficient than threads, there’s a couple interesting performance gotchas like this one that apply for certain libraries and applications.

Due to those I’m still m curious for how many applications the async model is actually a net win or a net loss. Too bad we don’t have time to implement all applications in both ways to gather more data.

Re:The Size of Rust Futures by pipologist on Saturday January 28, 2023 @08:15AM (#34557326)
That’s probably why C++ couroutines allocate by default.
Re:The Size of Rust Futures by pornel on Saturday January 28, 2023 @08:30AM (#34557424)
Yup, I've ran into this when my entire program ended up being a single massive Future struct, which caused a stack overflow :)

I wish there was a Clippy lint for this (https://github.com/rust-lang/rust-clippy/issues/5263).

My current practice is to sprinkle `Box::pin` on code paths that are less common (fallbacks, error handling) or expensive anyway. This cuts down the inlined state considerably without actually causing that many allocations.

Re:The Size of Rust Futures by IshKebab on Saturday January 28, 2023 @08:43AM (#34557504)
Feels like the list of Rust async gotchas is quite long. It would be good to see them all in one place.