rayon-rs

rayon: Parallelize Rust Computations Safely

Rayon is a Rust library for parallelizing data processing and independent tasks while preserving data-race freedom. It suits Rust developers who want to use multiple CPU cores with familiar iterator-style code or explicit task control.

View on GitHub Compare
Stars
13.4k
Forks
613
Stars, last 30 days
+85

Our take

Health score

46/100

How it is scored
Activity
33
Community
83
Issues
21
Pull requests
46

+85 stars in the last 30 days

  • More contributors than 78% of the projects we track

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

13,471

Forks

663

Change since Nov 15, 2026: +2 stars·+34 forks

Overview

Rayon helps Rust developers run suitable computations across multiple CPU cores without manually managing the division of work. Its parallel iterator APIs let you adapt many sequential iterator workflows, while task APIs provide more control when needed.

Rayon is a good fit when a workload can be split into independent pieces and you want Rust's type system to help prevent data races. It does not make every computation faster: the work must benefit from parallel execution, and side effects may happen in a different order.

Key Features

  • Parallel iterator APIs for processing collections and other supported data in parallel.
  • Work is divided into tasks and dynamically adapted by the parallel iterator machinery.
  • join and scope APIs for creating parallel tasks directly.
  • Custom thread pools for applications that need control beyond the default global pool.
  • APIs guarantee data-race freedom.
  • Parallel iterator results generally match sequential results, subject to caveats such as side-effect ordering.
  • On WebAssembly without multithreading support, parallel iteration falls back to sequential execution.

Use Cases

  • Rust developers can parallelize CPU-heavy collection operations, such as mapping values and aggregating results.
  • Scientific or simulation software can distribute independent calculations across cores.
  • Applications with multiple independent tasks can use join or scope rather than limiting parallelism to iterator pipelines.
  • Projects that need isolated or specifically configured worker pools can create custom thread pools.

Getting Started

Add Rayon to Cargo.toml:

[dependencies]
rayon = "1.12"

Import the prelude with use rayon::prelude::*; to access parallel iterator APIs. See the README for examples, WebAssembly guidance, and contribution details.

Considerations

  • Requires rustc 1.85.0 or greater.
  • Parallel execution is not guaranteed to improve performance. It is most useful when work can be divided effectively and the parallel overhead is worthwhile.
  • Side effects in parallel iterators can occur in a different order than in sequential execution.
  • WebAssembly builds without multithreading support run sequentially by default. Multithreaded WebAssembly requires an adapter and additional configuration.
  • Data-race freedom does not rule out every kind of parallel-programming bug.

Found this useful?

Share it with someone who would like rayon.