677
STOP DOING ASYNC
(lemmy.world)
Post funny things about programming here! (Or just rant about your favourite programming language.)
Honestly I can't wrap my head how to effectively put computation into a thread, even with Tokio.
All I want is something like rayon where you got a task queue and you just yeet tasks into a free thread, and await when you actually need it
Might be too much JS/TS influence on me, or that I can't find a tutorial that would explain in a way that clicks for me
Tokio specifically says not to use it for CPU intensive tasks and rayon would be better for this: https://tokio.rs/tokio/tutorial
Tokio is for concurrency, not parallelism. Use it for IO stuff. They say rayon is good for that, but I haven't used that. If you just want something simple, I'd recommend working with threadpool.