Skip to content
CAI
Software that uses CAICheck a score

rayon-rs/rayon

66.6

Adequate · 29 September 2026

34.7k

lines of production code

Rust

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a Rust library providing parallel iteration and task scheduling capabilities, structured into a core thread-pool engine and a higher-level iterator API. It enables users to process data and execute tasks concurrently using parallel iterators for collections and slices, as well as explicit scoped thread pools and broadcast operations for fine-grained control. The library includes comprehensive benchmarking demos and strict compile-time safety checks to ensure correct parallel usage.

How it got here

2014–2016 — API overhaul and demo expansion

14 changes.

The project underwent a major API restructuring with the Rayon 2.0 release, migrating to the Rust 2024 edition and introducing modern scoped thread APIs and expanded parallel iterator support. Concurrently, the rayon-demo application was consolidated and significantly expanded with a comprehensive suite of benchmarks and visualizations for algorithms such as sorting, matrix multiplication, and the traveling salesman problem.

2017 — rayon-core extraction and API stabilization

15 changes.

This period focused on extracting core parallelism APIs into the rayon-core crate to establish a stable foundation for thread management and task scheduling. Significant enhancements included the introduction of scoped thread pools, user-managed thread pools, and optimized parallel iterator adaptors for collections and slices.

2018–2022 — API expansion and test hardening

8 changes.

This period focused on expanding rayon-core's capabilities with new broadcast and spawn\_broadcast APIs for thread-pool-wide operations. Significant effort was also dedicated to improving reliability through comprehensive integration tests and compile-fail doctests that enforce safety constraints. Additionally, the rayon-demo suite was enhanced with new tools for measuring and monitoring CPU usage.

Features

Add Conway's Game of Life benchmark and demo

The rayon-demo now includes a Conway's Game of Life implementation that allows users to benchmark parallel iteration strategies. Users can run the demo in 'bench' mode to compare the performance of standard sequential generation, Rayon's parallel iterators, and the parallel bridge iterator, or in 'play' mode to visualize the simulation with configurable board size, generation count, and frame rate limits. The implementation uses Arc for rule storage to reduce allocations and supports skipping the bridge benchmark if desired.

rayon-demo/src/life · high confidence

Add cross-platform CPU time measurement to the demo

The demo now includes a new \cpu\_time\ module that measures and displays both wall-clock time and CPU usage percentage for operations. This feature uses platform-specific APIs (\getrusage\ on Unix, \GetProcessTimes\ on Windows) to retrieve accurate CPU time, falling back to \N/A\ on unsupported platforms. Users can now see how much of the execution time was spent actually using the CPU versus waiting, providing better insight into performance characteristics within the demo environment.

_rayon-demo/src/cpu\time · high confidence

Add noop demo for CPU usage measurement

A new demo application named 'noop' has been added to the rayon-demo suite. This tool allows users to measure CPU usage by spawning empty tasks with configurable sleep intervals and iteration counts, utilizing the existing cpu\_time measurement utilities.

rayon-demo/src/noop · high confidence

Add parallel mergesort demo with benchmarking

The mergesort demo now includes a new parallel sorting implementation that uses \MaybeUninit\ buffers for efficient memory management during the merge step, along with a dedicated benchmark harness to compare parallel versus sequential performance.

rayon-demo/src/mergesort · high confidence

Added TSP benchmark data for Djibouti locations

Added TSPLIB-format input files (dj10.tsp, dj15.tsp, dj38.tsp) and accompanying README documentation to the rayon-demo/data directory. These files provide coordinate data for 10, 15, and 38 locations in Djibouti, derived from the dj38.tsp dataset, to support the parallel Traveling Salesman Problem solver benchmarks.

rayon-demo/data · high confidence

Added \`spawn\_fifo\` for FIFO-ordered task execution

Rayon now provides a \spawn\_fifo\ function that enforces First-In-First-Out (FIFO) execution order for tasks spawned from the same thread, contrasting with the default Last-In-First-Out (LIFO) behavior of \spawn\. This allows users to guarantee that tasks are processed in the order they were submitted when local stealing does not occur, addressing scheduling needs where strict ordering is required without relying on global scope mechanisms.

rayon-core/src/spawn · high confidence

Added factorial benchmark suite to rayon-demo

The factorial demo module now includes a comprehensive set of benchmarks comparing various computation strategies. Users can now evaluate performance differences between plain iterators, parallel iterators (par\_iter), fold-based parallel operations (fold\_with, fold\_chunks\_with), serial divide-and-conquer recursion, and parallel divide-and-conquer using rayon::join. This provides a concrete reference for understanding the performance characteristics of different parallelization approaches for factorial calculation.

rayon-demo/src/factorial, rayon-demo/src/fibonacci · high confidence

Added interactive CPU monitoring example

An interactive example named \cpu\_monitor\ has been added to the \rayon-demo\ examples directory. This tool allows users to manually monitor Rayon's CPU usage under specific scenarios, such as when tasks have finished or when tasks are stalled at the root or scope level. It is designed for manual, interactive testing rather than automated execution.

rayon-demo/examples · high confidence

Added parallel TSP solver demo with benchmarking

The \rayon-demo/src/tsp\ module now includes a parallel implementation of the Travelling Salesman Problem solver, demonstrating the use of \rayon::scope\ for task parallelism. This addition introduces a complete set of components including graph representation, TSPLIB file parsing, and a priority-queue-based search algorithm that splits work across threads. A new benchmark suite (\bench.rs\) has been added to measure performance against expected path weights and sequences, allowing users to evaluate the solver's efficiency.

rayon-demo/src/tsp · high confidence

Added parallel find performance benchmarks

The \rayon-demo\ now includes a new \find\ module that benchmarks parallel search operations (\find\_any\, \find\_first\) against serial equivalents. These benchmarks measure performance across different data positions (start, end, middle, third) and utilize exponential blocking strategies to evaluate the efficiency of parallel iteration in finding specific elements within large datasets.

rayon-demo/src/find · high confidence

Added parallel matrix multiplication demo with benchmarking

The rayon-demo now includes a new \matmul\ module that demonstrates parallel matrix multiplication using the Rayon library. This addition provides both a command-line tool for running benchmarks (\matmul bench\) and a suite of implementation strategies, including sequential row-major, Z-order (Morton order), and Strassen's algorithm variants. The entry point allows users to specify matrix sizes and observe performance differences across these parallelization techniques.

rayon-demo/src/matmul · high confidence

Added quicksort demo with parallel/sequential benchmarking

The quicksort demo now includes a benchmarking mode that allows users to compare the performance of parallel versus sequential sorting algorithms. The demo provides command-line options to run benchmarks, specify the dataset size, and optionally skip the sequential sort to measure parallel performance in isolation. It uses Rayon for parallel execution and includes a custom splitter implementation for parallel iteration.

rayon-demo/src/quicksort · high confidence

Consolidated rayon-demo with new benchmarks and CLI interface

The rayon-demo application has been restructured into a single binary with a modular source layout. A new CLI interface in main.rs allows users to run specific demos (life, nbody, sieve, matmul, mergesort, quicksort, tsp, noop) or the full benchmark suite via \rayon-demo bench\. The demo now includes a comprehensive suite of microbenchmarks: join\_microbench.rs tests parallel join strategies with min/max length controls; map\_collect.rs and vec\_collect.rs compare various parallel collection patterns (e.g., mutex-based, linked-list intermediaries, fold-reduce) for HashMap and Vec; sort.rs benchmarks parallel sorting algorithms (par\_sort, par\_sort\_unstable) on various data distributions; str\_split.rs evaluates parallel string splitting performance; and tree.rs benchmarks parallel tree traversal operations.

rayon-demo/src · high confidence

Extracted join implementation into rayon-core

The \join\ and \join\_context\ functions, which allow executing two closures potentially in parallel using work-stealing, have been extracted into the \rayon-core\ crate. This change exposes the core parallel execution logic as a public API within \rayon-core\, including the \FnContext\ type that indicates whether a closure is executing on the calling thread or has been stolen by another worker. The module includes comprehensive tests for sorting, panic propagation, and context migration.

rayon-core/src/join · high confidence

Initial project documentation and licensing files added

This change introduces the foundational documentation and legal files for the Rayon project, including a comprehensive README.md detailing usage and parallel iterators, a FAQ.md addressing common questions about thread counts and interior mutability, a RELEASES.md history, and the dual MIT/Apache 2.0 license files. It also adds a .gitignore to exclude build artifacts and IDE files.

(repo-wide) · high confidence

New broadcast and spawn\_broadcast APIs for thread-pool-wide operations

Rayon-core now exposes \broadcast\ and \spawn\_broadcast\ functions, along with corresponding methods on \ThreadPool\, allowing a closure to be executed across every thread in a thread pool simultaneously. The synchronous \broadcast\ variant waits for all threads to complete and returns a vector of their results, while the asynchronous \spawn\_broadcast\ variant injects the task for execution on each thread without blocking the caller. Both APIs provide a \BroadcastContext\ to the closure, enabling it to determine its specific thread index and the total number of participating threads, which facilitates coordination and data distribution across the entire pool.

rayon-core/src/broadcast · high confidence

New fork-join scope primitives for flexible parallel task spawning

The \rayon-core\ crate now exposes a new \scope\ module providing \scope()\ and \in\_place\_scope()\ functions, along with \Scope\ and \ScopeFifo\ types. These allow users to create flexible fork-join scopes where tasks can be spawned dynamically (e.g., inside loops) without the recursion limits of \join()\. \scope\_fifo()\ offers FIFO prioritization for tasks spawned from the same thread, while \in\_place\_scope()\ allows the driver closure to run on the creator's thread. The module includes comprehensive tests for panic propagation, stack growth, and task ordering.

rayon-core/src/scope · high confidence

New nbody benchmark and visualization demo

The rayon-demo now includes a new nbody simulation demo that allows users to benchmark and visualize parallel performance. The demo supports three execution modes: sequential, parallel (using rayon's parallel iterators), and parallel reduce. Users can run benchmarks to compare execution times and speedups between modes, or launch a graphical visualization of the physics simulation using OpenGL via glium. The implementation includes benchmarking infrastructure to measure performance across different parallelization strategies.

rayon-demo/src/nbody · high confidence

New parallel iterator adaptors for chaining, cloning, copying, and chunking

The \src/iter\ module introduces several new parallel iterator adapters to enhance data processing capabilities. Users can now chain iterators with \Chain\, clone or copy elements from references using \Cloned\ and \Copied\, and split sequences into fixed-size groups with \Chunks\. Additionally, the module adds \BlocksCallback\ to support exponential and uniform block sizing strategies, enabling more granular control over parallel work distribution.

src/iter · high confidence

New parallel slice iteration and sorting methods

This release adds several new parallel iteration capabilities for slices, including \par\_chunk\_by\ (and its mutable variant) to split slices based on a predicate, \par\_array\_windows\ for overlapping fixed-size array windows, and reverse-chunk iterators (\par\_rchunks\, \par\_rchunks\_exact\). It also introduces parallel sorting methods (\par\_sort\, \par\_sort\_by\, \par\_sort\_unstable\, \par\_sort\_by\_key\) backed by a new \sort.rs\ module implementing parallel mergesort and quicksort, along with a parallel implementation of \sort\_by\_cached\_key\.

src/slice · high confidence

Parallel iteration support added for standard collections

The \src/collections\ module now provides parallel iterator implementations for standard library types including \BinaryHeap\, \BTreeMap\, \BTreeSet\, \HashMap\, \HashSet\, \LinkedList\, and \VecDeque\. Users can now use \into\_par\_iter()\ on these collections to process their elements in parallel, and \HashMap\ and \HashSet\ additionally support parallel draining via \par\_drain()\ to remove items while preserving capacity.

src/collections · high confidence

Rayon-core 1.8.0: Extracted core APIs and introduced scoped thread pools

This release extracts the core stable APIs of Rayon into the rayon-core crate, providing a stable foundation for parallelism. Key additions include scoped thread pools via \scope()\ and \in\_place\_scope()\, allowing tasks to borrow data from the stack, and customizable thread spawning through \ThreadPoolBuilder::spawn\_handler()\. The release also introduces \start\_handler\ and \exit\_handler\ callbacks for thread lifecycle monitoring, a fallback mode for unsupported threading targets like WebAssembly, and new yield primitives (\yield\_now\, \yield\_local\) to improve scheduling efficiency.

rayon-core/src · high confidence

User-managed thread pools with explicit install and broadcast APIs

Rayon now exposes a \ThreadPool\ type in \rayon-core\ that allows users to create and manage their own thread pools explicitly via \ThreadPoolBuilder\. Users can execute work within a specific pool using \ThreadPool::install()\, which supports nested calls and inter-pool execution without deadlocking, and \ThreadPool::broadcast()\ to run operations on every thread in the pool. This replaces the previous implicit global-pool model for custom configurations, providing finer control over thread lifecycle and execution context.

_rayon-core/src/thread\pool · high confidence

rayon-core adds license files, README, and build script

The rayon-core crate now includes LICENSE-APACHE and LICENSE-MIT files to clarify its dual-licensing terms, a README.md explaining its role as the stable core API for Rayon and its requirement of rustc 1.85.0 or greater, and a build.rs script that uses the \links\ attribute to ensure only one version of rayon-core is linked in a project, preventing multiple thread pool instances.

rayon-core · high confidence

Behavioural changes

Documentation and code style updates in parallel iterator plumbing

The \src/iter/plumbing\ module received a new README explaining the design of parallel iterator traits (pull/push modes, producers, consumers, and the bridge mechanism), and the module's doc comments were updated to use absolute GitHub links, indicative mood, and clearer wording. The code was also formatted and cleaned up to address Clippy warnings, including fixing legacy numeric constants and using \Ord::min\/\max\ from the prelude instead of \cmp\.

src/iter/plumbing · medium confidence

Optimized parallel find\_first and find\_last operations

The \find\_first\ and \find\_last\ parallel iterator operations now use an optimized consumer strategy that assigns each worker a specific index range. This allows workers to stop processing early if a better match is found by a neighboring worker, significantly improving performance on large datasets. The implementation uses atomic updates to coordinate between workers and includes specific handling for edge cases where range resolution is exhausted.

_src/iter/find\_first\last · high confidence

Pythagoras demo ported to weightless parallel iteration

The pythagoras demo now includes a 'weightless' parallel implementation that relies on default split lengths rather than explicit min/max length tuning, alongside benchmarks comparing this approach against both serial execution and various parallel configurations (fully serialized, outer-loop parallel, and fully parallel).

rayon-demo/src/pythagoras · high confidence

Rayon 2.0: Complete API overhaul and Rust 2024 edition migration

This release introduces a major breaking change by migrating the crate to the Rust 2024 edition and raising the Minimum Supported Rust Version (MSRV) to 1.85. The public API has been significantly restructured: the legacy \execute\ function and \Section\ type have been removed in favor of modern scoped thread APIs (\scope\, \in\_place\_scope\, \scope\_fifo\) and explicit \ThreadPool\ management via \ThreadPoolBuilder\. Parallel iterator support has been expanded to include arrays (\\[T; N\]\), \Option\, \Result\, and \Either\ types, with dedicated modules for each. String handling is now unified under the \ParallelString\ trait, providing methods like \par\_chars\, \par\_split\, and \par\_bytes\. Additionally, the library now supports draining ranges from \Vec\ and \String\ via \ParallelDrainRange\, and introduces a \SendPtr\ type to safely transmit raw pointers across threads.

src · high confidence

Rayon demo sieve now uses with\_max\_len for parallel chunking

The Sieve of Eratosthenes demo in rayon-demo has been updated to use the \with\_max\_len(1)\ method on parallel chunk iterators. This change ensures that each chunk is processed as a separate Rayon job, allowing for finer-grained parallelism and potentially better performance on workloads with smaller data sets or specific cache characteristics.

rayon-demo/src/sieve · high confidence

Refined worker thread sleep and wake protocol to prevent deadlocks

The sleep module's internal logic for managing worker thread states has been restructured to improve reliability and performance. The system now distinguishes more clearly between 'inactive' (idle or sleepy) and 'sleeping' states, using a packed atomic counter to track these efficiently. A key behavioral change is the addition of a final check for injected jobs immediately before a thread blocks, which prevents potential deadlocks where external work might be missed due to race conditions or counter rollover. Additionally, the protocol for posting work and detecting 'sleepy' threads has been tightened using sequential consistency fences and an even/odd toggle scheme for the Jobs Event Counter, ensuring that threads wake up promptly when new work arrives.

rayon-core/src/sleep · high confidence

Safer parallel collection with strict bounds checking and proper drop semantics

The \src/iter/collect\ module has been rewritten to improve safety and correctness when collecting parallel iterators into vectors. The new implementation uses \CollectConsumer\ and \CollectResult\ to strictly track initialized elements, ensuring that panics or shortfalls in producers are caught early with clear assertions (e.g., "too many values" or "expected X total writes"). It also guarantees correct dropping of partially initialized elements during unwinds by managing ownership via \CollectResult\ and using \ptr::slice\_from\_raw\_parts\_mut\ for safe drop placement. Additionally, the module now supports \unzip\_into\_vecs\ for parallel unzipping and enforces that \full()\ is a required method, simplifying the consumer interface.

src/iter/collect · high confidence

Test coverage

Added compile-fail tests for parallel iterator constraints; Added compile-fail tests for rayon-core safety constraints; Added integration tests for ThreadPoolBuilder and scoped execution; CI check to enforce single rayon-core dependency; Expanded test coverage for parallel iterators and collection adaptors.

Dependencies

Rayon 1.12.0 release with Rust 2024 edition and workspace restructuring

This update releases Rayon version 1.12.0 and rayon-core 1.13.0, upgrading the project to the Rust 2024 edition and raising the Minimum Supported Rust Version (MSRV) to 1.85. The codebase has been restructured into a Cargo workspace, centralizing dependency management for crates like crossbeam-deque, rand, and wasm\_sync. A new \web\_spin\_lock\ feature is introduced to support the \wasm32-unknown-unknown\ target by switching to a spin-lock implementation, and the \rayon-demo\ application has been updated to use glium 0.36 and winit 0.30.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 75 → 67 (-8.1)
  • Rubric changed (rubric-2026.09.8 → rubric-2026.09.17) — scores are not directly comparable.

Lenses

  • Code Health 96 → 96 (+0.0)
  • Architecture 99 → 92 (-7.3)
  • Maturity 64 → 64 (+0.0)
  • Readiness 74 → 54 (-20.8)
  • Security 85 → 90 (+4.9)

Resolved (3)

  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Off-boarding risk: anonymized user #1

New (14)

  • Dependency hygiene PARTLY measured — Cargo dependencies read, no committed lock to grade for currency
  • Duplicate intent: Both ThreadPoolBuilder and Configuration expose an identical breadth_first setter.
  • Duplicate intent: Both ThreadPoolBuilder and Configuration expose an identical exit_handler setter.
  • Duplicate intent: Both ThreadPoolBuilder and Configuration expose an identical num_threads setter. Since Configuration is used to construct ThreadPool (and potentially ThreadPoolBuilder), having the same configuration method on both types suggests a lack of clear separation between 'configuration data' and 'builder logic'.
  • Duplicate intent: Both ThreadPoolBuilder and Configuration expose an identical panic_handler setter.
  • Duplicate intent: Both ThreadPoolBuilder and Configuration expose an identical stack_size setter.
  • Duplicate intent: Both ThreadPoolBuilder and Configuration expose an identical start_handler setter.
  • Duplicate intent: Both ThreadPoolBuilder and Configuration expose an identical thread_name setter.
  • Duplicate intent: Two distinct types (ThreadPoolBuilder and Configuration) expose a build() method that returns a Result (presumably of a ThreadPool). This creates ambiguity for users on which builder pattern to use or implies redundant functionality.
  • Duplicate intent: ThreadPool exposes spawn_fifo and scope_fifo. While spawn and scope are distinct concepts (global vs scoped), the fifo variant is attached to both. This is less of a duplication and more of a naming consistency issue with spawn_broadcast/broadcast above, but spawn_fifo vs scope_fifo is consistent with spawn vs scope. However, spawn_broadcast vs broadcast is the outlier.
  • Duplicate intent: ThreadPool exposes both spawn_broadcast and broadcast. Given the existence of Scope.spawn_broadcast and ScopeFifo.spawn_broadcast, the naming convention is inconsistent within the ThreadPool type itself. spawn is used for general tasks, but broadcast is used for the broadcast operation, while spawn_broadcast exists as a variant.
  • Off the main sequence: rayon-core
  • Off-boarding risk: anonymized user #1
  • Projects may be oversized for their cohesion

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

rayon-rs/rayon was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 29 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit ee0a00bdb1ab039e178a215ad5712fb7fa58e58f — the exact code this score is about.
  • Scored under rubric-2026.09.17 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-70910855e4b4.