Maven (famous)@lemmy.world to Programmer Humor@lemmy.ml · 9 months agoSTOP DOING ASYNClemmy.worldimagemessage-square9fedilinkarrow-up17arrow-down10
arrow-up17arrow-down1imageSTOP DOING ASYNClemmy.worldMaven (famous)@lemmy.world to Programmer Humor@lemmy.ml · 9 months agomessage-square9fedilink
minus-squareRustyNova@lemmy.worldlinkfedilinkarrow-up0·9 months agoHonestly 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
minus-squarePlexSheep@feddit.delinkfedilinkarrow-up0·9 months agoTokio 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.
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 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.