rayon: Parallelize Rust Computations Safely

rayon: Parallelize Rust Computations Safely

Summary

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.

At a glance

Language
Rust
License
Apache-2.0
Stars
13.4k
Forks
613
Added to OSRepos
March 12, 2026
Last analyzed
October 3, 2026
View on GitHub

Topics

Click on any tag to explore related repositories

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

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.

Project Facts

  • Language: Rust
  • License: Apache-2.0
  • Stars: 13.4k
  • Forks: 613
  • Archived: No

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.

Source repository

Open the original repository on GitHub.

27 counted GitHub visits

View on GitHub

Related repositories

Similar repositories that may be relevant next.

OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️