tokio VS rayon

Compare tokio vs rayon and see what are their differences.

tokio

A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ... (by tokio-rs)

rayon

Rayon: A data parallelism library for Rust (by rayon-rs)
Our great sponsors
  • Scout APM - A developer's best friend. Try free for 14-days
  • Nanos - Run Linux Software Faster and Safer than Linux with Unikernels
  • SaaSHub - Software Alternatives and Reviews
tokio rayon
70 15
13,967 5,837
3.8% 4.4%
9.6 6.9
6 days ago about 1 month ago
Rust Rust
MIT License GNU General Public License v3.0 or later
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

tokio

Posts with mentions or reviews of tokio. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-11-25.

rayon

Posts with mentions or reviews of rayon. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-10-17.
  • Is there an inverse to the Iterator trait?
    1 project | reddit.com/r/rust | 18 Nov 2021
    From what you said in the other post, it sounds like something that would work using iterators. You don't necessarily need to be pushing into a sink. Have you looked at Rayon? Seems like you could just stream your items through Rayon iterators and get it parallelized with very little extra effort.
  • Use `.skip()` on a `rayon::iter::Flatten`
    1 project | reddit.com/r/rust | 7 Nov 2021
    A relevant issue: https://github.com/rayon-rs/rayon/issues/210
  • Python stands to lose its GIL, and gain a lot of speed
    3 projects | news.ycombinator.com | 17 Oct 2021
    I'm looking forward to something like the brilliant rayon parallel operations library https://github.com/rayon-rs/rayon

    We won't get data race free guarantees but if built into pandas or Vaex we can have a near transparent API.

    It'll really open things up for those apps running on 32 core machines. They're out there, I deploy these things frequently (Plotly Dash framework for large Enterprise customers).

  • Rust for Data Science: Tutorial 1
    5 projects | dev.to | 24 Aug 2021
    Additionally, ndarray has got also some nice extra, such as support for rayon for parallelization, or the popular BLAS low-level specs, through one of the working back-ends (using blas-src ).
  • Rust: First Thoughts
    1 project | dev.to | 28 Jul 2021
    With Rust, thread-safe code become much easier to write, which follows from Rust’s core principle of ownership (In short, you can only have one mutable reference to any given piece of data). Simple map and reduce operations can be parallelized with great ease by dropping in Rayon. For other use cases you can wrap your code in an Arc (Atomic reference counter) and proceed a bit more manually. It’s still possible to shoot your self in the foot, but Rust protects you from many mistakes at compile time. I was able to parallelize some geospatial operations and graph traversal in a period of hours thanks to Rust’s robust tools for concurrency and parallelism.
  • Is there an asynchronous Hashmap or equivalent local DB?
    6 projects | reddit.com/r/rust | 13 Apr 2021
    Note: What about the approach of using a thread poll, do we even need async? While a thread poll would provide an improvement over your current approach (and is easy to scale using rayon) in this situation it would be sub-optimal if the round trip time (RTT) for each request is long. There is a portion of time where your computer is doing nothing, e.g. as the request gets routed to S3 and as S3 gathers the data to send back, your computer is sitting idle. But if you use an async approach, during this idle time, your computer can send more requests.
  • The Sad Truth About C++ Copy Elision
    2 projects | reddit.com/r/cpp | 4 Apr 2021
    A more practical example is the rayon library which lets you write parallelized multithreaded code simply by turning this:
  • tokio-rayon: Mix Tokio async and CPU-bound work using Rayon thread pools
    3 projects | reddit.com/r/rust | 2 Apr 2021
    FWIW, I prototyped rayon#679 to spawn futures, but we didn't come to consensus on the design, and I'm didn't have enough interest to keep pushing on it. That was roughly a hand-rolled one-shot channel, but it looks a lot nicer that you used a real channel.
  • Hey Rustaceans! Got an easy question? Ask here (12/2021)!
    15 projects | reddit.com/r/rust | 22 Mar 2021
    You might want to look at Rayon instead, which is designed for compute-heavy parallelism. If your algorithm can be expressed using iterators, it's likely pretty straightforward to parallelize it with Rayon. Otherwise, you might look at rayon::join() which you can call recursively.
  • World’s First 1k-Processor Chip, Powered by a Single AA Battery (2016)
    3 projects | news.ycombinator.com | 15 Feb 2021
    Rust's Rayon library is pretty good for these use-cases https://github.com/rayon-rs/rayon

        use rayon::prelude::*;

What are some alternatives?

When comparing tokio and rayon you can also consider the following projects:

crossbeam - Tools for concurrent programming in Rust

async-std - Async version of the Rust standard library

Rocket - A web framework for Rust.

sqlx - 🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, SQLite, and MSSQL.

smol - A small and fast async runtime for Rust

hyper - An HTTP library for Rust

RxRust - The Reactive Extensions for the Rust Programming Language

bevy - A refreshingly simple data-driven game engine built in Rust

warp - A super-easy, composable, web server framework for warp speeds.

winit - Window handling library in pure Rust

sled - the champagne of beta embedded databases

coroutine-rs - Coroutine Library in Rust