• Spaz@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    9 months ago

    Tokio specifically says not to use it for CPU intensive tasks and rayon would be better for this: https://tokio.rs/tokio/tutorial

    Speeding up CPU-bound computations by running them in parallel on several threads. Tokio is designed for IO-bound applications where each individual task spends most of its time waiting for IO. If the only thing your application does is run computations in parallel, you should be using rayon. That said, it is still possible to “mix & match” if you need to do both. See this blog post for a practical example