This is a sophisticated benchmarking framework written in Rust that provides detailed CPU cycle-level performance analysis for various programming patterns and techniques. The project focuses on micro-optimizations and empirical performance comparisons of different implementation approaches.
Rust library for measuring code performance in CPU cycles
- Provides benchmarking tools for various Rust programming patterns and techniques
- Includes examples comparing allocation strategies, lookup methods, iteration techniques, and parallelization approaches
- Focuses on micro-optimizations and understanding performance implications of different coding choices
mtr
= metrics
- Precise Performance Measurement
- Uses CPU cycle counting via RDTSC (Read Time-Stamp Counter)
- Provides high-resolution timing for micro-benchmarks
- Implements proper black-box optimizations to prevent compiler interference
- Comprehensive Benchmark Suites
- Memory allocation strategies (arrays vs vectors)
- Data structure access patterns (sequential vs random access)
- Iteration techniques (index-based vs iterators)
- Type casting performance (u8 vs usize)
- Loop unrolling optimizations
- Multi-threading approaches (1-16 threads)
- Thread synchronization methods (join vs mpsc channels)
- Key Findings
Memory Operations:
- Arrays generally outperform vector allocations for small sizes
- Vector with pre-allocated capacity performs better than macro-based initialization
- Sequential array access is faster than match-based lookups for small datasets
Iteration & Processing:
- Iterators often outperform index-based loops
- Bounds checking has minimal impact on modern Rust
- Loop unrolling effectiveness varies with data size
- Single accumulator is often more efficient than multiple accumulators for small datasets
Parallelization:
- Single-threaded processing outperforms multi-threaded for small datasets
- MPSC (Multiple Producer Single Consumer) channels preferred for thread communication
- Optimal thread count depends heavily on data size and processing requirements
- Threading overhead usually only justified for large datasets (>4096 elements)
- Written in idiomatic Rust with extensive use of generics and traits
- Leverages Rust's type system for zero-cost abstractions
- Uses low-level CPU features for precise timing
- Implements thread pooling and synchronization primitives
- Custom benchmarking harness with statistical analysis
This framework helps developers make data-driven decisions about:
- Algorithm implementation strategies
- Memory allocation patterns
- Concurrency approaches
- Performance optimization techniques
The empirical results challenge common assumptions about performance and provide concrete guidance for writing high-performance Rust code.
Skills Demonstrated:
- Deep understanding of Rust's performance characteristics
- Experience with systems programming and low-level optimization
- Ability to design and implement complex benchmarking systems
- Strong analytical skills and data-driven decision making
- Practical experience with concurrent programming patterns
- Knowledge of modern CPU architecture and performance considerations
The project shows both theoretical knowledge and practical implementation skills that are directly applicable to performance-critical Rust development.
- mtr - Performance Analysis Framework for Rust
- Key Features
- Technical Implementation
- Value Proposition
- Usage
- Examples
- Allocation: array vs vector macro
- Allocation: array vs vector capacity and resize
- Allocation: vector macro vs vector capacity and resize
- Lookup: Sequential: array vs match
- Lookup: Random: array vs match
- Iteration: range index (bounds checked) vs iterator
- Iteration: range index bounds checked vs range index unchecked
- Iteration: Vector: iterator vs into iterator
- Iteration: Slice: iterator vs into iterator
- Cast: u8 vs usize
- Accumulate: read pointer vs read de-referenced value
- Accumulate: total count vs multiple add one
- Accumulate: Unroll: Single accumulator: no unrolling vs unroll 8
- Accumulate: Unroll: 1 accumulator vs 8 accumulators
- Accumulate: Unroll: 8 accumulators vs 16 accumulators
- Accumulate: Unroll: no unrolling vs unroll 8 with 8 accumulators
- Accumulate: Unroll: no unrolling vs unroll 16 with 16 accumulators
- Accumulate: Parallel: single thread, single accumulator vs 2 threads, 2 accumulators
- Accumuate: single thread, unroll 2, 2 accumulator vs two thread, two accumulator, mspc
- Accumulate: Parallel: 2 threads, 2 accumulators, join vs 2 threads, 2 accumulators, mpsc
- Accumulate: Parallel: 2 threads, 2 accumulators, mspc vs 4 threads, 4 accumulators, mpsc
- Accumulate: Parallel: 1 thread, 1 accumulator vs 4 threads, 4 accumulators, mpsc
- Accumulate: Parallel: 4 threads, 4 accumulators, mspc vs 8 threads, 8 accumulators, mpsc
- Accumulate: Parallel: 8 threads, 8 accumulators, mspc vs 16 threads, 16 accumulators, mpsc
- Development notes
- File Tree
clear && cargo r -q --profile release
- Run with optimizations on. Either:
cargo run --profile release
rustc -C opt-level=3
Prefer array.
βββββββββββββββββββββ¬βββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬ββββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1,024 β 2,048 β 4,096 β 8,192 β 16,384 β 32,768 β 65,536 β 131,072 β
βββββββββββββββββββββͺβββββͺβββββͺβββββͺββββββͺββββββͺββββββͺββββββββͺββββββββͺββββββββͺββββββββͺβββββββββͺβββββββββͺβββββββββͺββββββββββ‘
β alc,arr β 2 β 2 β 4 β 10 β 18 β 34 β 128 β 236 β 432 β 878 β 2,730 β 5,442 β 11,028 β 22,134 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌββββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββ€
β alc,mcr,vec β 40 β 74 β 56 β 58 β 104 β 118 β 124 β 190 β 318 β 1,006 β 2,612 β 5,308 β 11,192 β 22,588 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌββββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββ€
β ratio (max / min) β 20 β 37 β 14 β 5.8 β 5.8 β 3.5 β 1 β 1.2 β 1.4 β 1.1 β 1 β 1 β 1 β 1 β
βββββββββββββββββββββ΄βββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄ββββββββββ
Prefer array.
βββββββββββββββββββββ¬βββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬βββββββ¬βββββββ¬βββββββ¬βββββββ¬ββββββββ¬ββββββββ¬βββββββββ¬βββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββͺβββββͺβββββͺβββββͺββββββͺββββββͺββββββͺβββββββͺβββββββͺβββββββͺβββββββͺββββββββͺββββββββͺβββββββββͺβββββββββ‘
β alc,arr β 4 β 4 β 4 β 12 β 20 β 36 β 132 β 242 β 432 β 886 β 2,770 β 5,738 β 11,556 β 23,002 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌβββββββββΌβββββββββ€
β alc,rsz,vec β 24 β 28 β 32 β 32 β 38 β 98 β 124 β 192 β 326 β 668 β 2,770 β 5,886 β 10,698 β 21,476 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌβββββββββΌβββββββββ€
β ratio (max / min) β 6 β 7 β 8 β 2.7 β 1.9 β 2.7 β 1.1 β 1.3 β 1.3 β 1.3 β 1 β 1 β 1.1 β 1.1 β
βββββββββββββββββββββ΄βββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄βββββββ΄βββββββ΄βββββββ΄βββββββ΄ββββββββ΄ββββββββ΄βββββββββ΄βββββββββ
Prever vector capacity and resize.
βββββββββββββββββββββ¬βββββ¬ββββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬βββββββ¬βββββββ¬βββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬βββββββββ¬βββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββͺβββββͺββββββͺβββββͺββββββͺββββββͺββββββͺβββββββͺβββββββͺβββββββͺββββββββͺββββββββͺββββββββͺβββββββββͺβββββββββ‘
β alc,mcr,vec β 72 β 72 β 90 β 56 β 98 β 120 β 174 β 196 β 510 β 1,072 β 2,850 β 5,126 β 11,082 β 22,140 β
βββββββββββββββββββββΌβββββΌββββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββ€
β alc,rsz,vec β 24 β 26 β 30 β 36 β 38 β 88 β 148 β 258 β 484 β 1,020 β 2,798 β 5,092 β 11,062 β 20,412 β
βββββββββββββββββββββΌβββββΌββββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββ€
β ratio (max / min) β 3 β 2.8 β 3 β 1.6 β 2.6 β 1.4 β 1.2 β 1.3 β 1.1 β 1.1 β 1 β 1 β 1 β 1.1 β
βββββββββββββββββββββ΄βββββ΄ββββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄βββββββ΄βββββββ΄βββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄βββββββββ΄βββββββββ
Prefer array.
βββββββββββββββββββββ¬βββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββββ¬ββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1,024 β 2,048 β
βββββββββββββββββββββͺβββββͺβββββͺβββββͺββββββͺββββββͺββββββͺββββββββͺββββββββ‘
β arr,rd,seq β 2 β 2 β 2 β 2 β 0 β 2 β 2 β 2 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌββββββββΌββββββββ€
β mat,rd,seq β 2 β 16 β 32 β 70 β 134 β 260 β 510 β 1,012 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌββββββββΌββββββββ€
β ratio (max / min) β 1 β 8 β 16 β 35 β 134 β 130 β 255 β 506 β
βββββββββββββββββββββ΄βββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββββ΄ββββββββ
Prefer match.
βββββββββββββββββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββββ¬ββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β
βββββββββββββββββββββͺββββββͺββββββͺββββββͺββββββͺββββββͺββββββͺββββββββͺββββββββ‘
β arr,rnd,rd β 38 β 58 β 86 β 208 β 430 β 836 β 1,766 β 3,344 β
βββββββββββββββββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββββΌββββββββ€
β mat,rnd,rd β 42 β 54 β 130 β 190 β 400 β 724 β 1,418 β 2,406 β
βββββββββββββββββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββΌββββββββΌββββββββ€
β ratio (max / min) β 1.1 β 1.1 β 1.5 β 1.1 β 1.1 β 1.2 β 1.2 β 1.4 β
βββββββββββββββββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββββ΄ββββββββ
Prefer iterator.
βββββββββββββββββββββ¬βββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬βββββββ¬βββββββ¬βββββββ¬βββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬βββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββͺβββββͺβββββͺβββββͺββββββͺββββββͺββββββͺβββββββͺβββββββͺβββββββͺβββββββͺββββββββͺββββββββͺββββββββͺβββββββββ‘
β idx,lop β 2 β 2 β 2 β 2 β 2 β 2 β 6 β 2 β 18 β 10 β 10 β 12 β 10 β 24 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββ€
β itr,lop β 2 β 2 β 2 β 2 β 2 β 2 β 2 β 2 β 2 β 10 β 2 β 12 β 10 β 22 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββ€
β ratio (max / min) β 1 β 1 β 1 β 1 β 1 β 1 β 3 β 1 β 9 β 1 β 5 β 1 β 1 β 1.1 β
βββββββββββββββββββββ΄βββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄βββββββ΄βββββββ΄βββββββ΄βββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄βββββββββ
Tie.
βββββββββββββββββββββ¬βββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬βββββββ¬βββββββ¬βββββββ¬βββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬βββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββͺβββββͺβββββͺβββββͺββββββͺββββββͺββββββͺβββββββͺβββββββͺβββββββͺβββββββͺββββββββͺββββββββͺββββββββͺβββββββββ‘
β chk,idx,lop β 0 β 0 β 0 β 0 β 0 β 0 β 0 β 0 β 0 β 0 β 0 β 24 β 14 β 14 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββ€
β idx,lop,unchk β 0 β 0 β 0 β 0 β 0 β 0 β 4 β 2 β 2 β 0 β 0 β 20 β 14 β 22 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββ€
β ratio (max / min) β 0 β 0 β 0 β 0 β 0 β 0 β 4 β 2 β 2 β 0 β 0 β 1.2 β 1 β 1.6 β
βββββββββββββββββββββ΄βββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄βββββββ΄βββββββ΄βββββββ΄βββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄βββββββββ
Prefer iterator.
βββββββββββββββββββββ¬βββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬βββββββ¬βββββββ¬βββββββ¬βββββββ¬βββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬βββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββͺβββββͺβββββͺβββββͺββββββͺββββββͺβββββββͺβββββββͺβββββββͺβββββββͺβββββββͺββββββββͺββββββββͺββββββββͺβββββββββ‘
β itr,lop β 4 β 4 β 4 β 4 β 4 β 4 β 6 β 4 β 4 β 4 β 4 β 4 β 20 β 18 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββ€
β into_itr,lop β 16 β 16 β 16 β 16 β 18 β 54 β 72 β 52 β 48 β 62 β 96 β 100 β 130 β 254 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββ€
β ratio (max / min) β 4 β 4 β 4 β 4 β 4.5 β 13.5 β 12 β 13 β 12 β 15.5 β 24 β 25 β 6.5 β 14.1 β
βββββββββββββββββββββ΄βββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄βββββββ΄βββββββ΄βββββββ΄βββββββ΄βββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄βββββββββ
Tie.
βββββββββββββββββββββ¬βββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬βββββββ¬βββββββ¬βββββββ¬βββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬βββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββͺβββββͺβββββͺβββββͺββββββͺββββββͺββββββͺβββββββͺβββββββͺβββββββͺβββββββͺββββββββͺββββββββͺββββββββͺβββββββββ‘
β itr,lop,slc β 2 β 4 β 2 β 2 β 2 β 2 β 2 β 2 β 2 β 2 β 2 β 2 β 14 β 20 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββ€
β into_itr,lop,slc β 2 β 2 β 4 β 2 β 2 β 2 β 2 β 2 β 2 β 2 β 2 β 2 β 14 β 22 β
βββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββ€
β ratio (max / min) β 1 β 2 β 2 β 1 β 1 β 1 β 1 β 1 β 1 β 1 β 1 β 1 β 1 β 1.1 β
βββββββββββββββββββββ΄βββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄βββββββ΄βββββββ΄βββββββ΄βββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄βββββββββ
Note:
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/bens.rs:18207:44
|
18207 | for val in vals.as_slice().into_iter() {
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
= note: `#[warn(clippy::into_iter_on_ref)]` on by default
Prefer usize.
βββββββββββββββββββββ¬ββββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬ββββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββͺββββββͺβββββͺββββββͺββββββͺββββββͺββββββͺββββββββͺββββββββͺββββββββͺββββββββͺβββββββββͺβββββββββͺβββββββββͺββββββββββ‘
β cst,u8 β 18 β 8 β 78 β 198 β 290 β 578 β 1,272 β 2,336 β 4,636 β 9,294 β 18,576 β 37,070 β 74,938 β 149,532 β
βββββββββββββββββββββΌββββββΌβββββΌββββββΌββββββΌββββββΌββββββΌββββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββ€
β cst,usize β 14 β 2 β 68 β 144 β 290 β 580 β 1,168 β 2,320 β 4,622 β 9,284 β 18,552 β 44,356 β 74,406 β 152,376 β
βββββββββββββββββββββΌββββββΌβββββΌββββββΌββββββΌββββββΌββββββΌββββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββ€
β ratio (max / min) β 1.3 β 4 β 1.1 β 1.4 β 1 β 1 β 1.1 β 1 β 1 β 1 β 1 β 1.2 β 1 β 1 β
βββββββββββββββββββββ΄ββββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄ββββββββββ
Tie. Slightly prefer read de-referenced value.
βββββββββββββββββββββ¬ββββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬ββββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββͺββββββͺβββββͺβββββͺββββββͺββββββͺββββββͺββββββββͺββββββββͺββββββββͺββββββββͺβββββββββͺβββββββββͺβββββββββͺββββββββββ‘
β acm,ptr,rd β 16 β 0 β 70 β 156 β 310 β 582 β 1,236 β 2,366 β 4,730 β 9,470 β 18,930 β 37,086 β 74,532 β 152,650 β
βββββββββββββββββββββΌββββββΌβββββΌβββββΌββββββΌββββββΌββββββΌββββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββ€
β acm,rd,val β 14 β 0 β 68 β 150 β 302 β 592 β 1,558 β 2,374 β 4,716 β 9,492 β 18,898 β 37,888 β 76,000 β 162,704 β
βββββββββββββββββββββΌββββββΌβββββΌβββββΌββββββΌββββββΌββββββΌββββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββ€
β ratio (max / min) β 1.1 β 0 β 1 β 1 β 1 β 1 β 1.3 β 1 β 1 β 1 β 1 β 1 β 1 β 1.1 β
βββββββββββββββββββββ΄ββββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄ββββββββββ
Prefer total count.
βββββββββββββββββββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬ββββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββͺβββββͺβββββͺββββββͺββββββͺββββββͺββββββͺββββββββͺββββββββͺββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺββββββββββ‘
β acm,add,one β 16 β 48 β 78 β 162 β 312 β 638 β 1,244 β 2,632 β 4,930 β 10,300 β 20,598 β 39,580 β 92,742 β 159,482 β
βββββββββββββββββββββΌβββββΌβββββΌββββββΌββββββΌββββββΌββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββ€
β acm,add,cnt β 16 β 2 β 70 β 200 β 298 β 604 β 1,198 β 2,358 β 4,736 β 9,460 β 18,926 β 37,904 β 75,944 β 152,638 β
βββββββββββββββββββββΌβββββΌβββββΌββββββΌββββββΌββββββΌββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββ€
β ratio (max / min) β 1 β 24 β 1.1 β 1.2 β 1 β 1.1 β 1 β 1.1 β 1 β 1.1 β 1.1 β 1 β 1.2 β 1 β
βββββββββββββββββββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄ββββββββββ
Prefer no unrolling.
βββββββββββββββββββββββββ¬βββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬βββββββ¬βββββββ¬βββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬βββββββββ¬βββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββββββͺβββββͺβββββͺβββββͺββββββͺββββββͺββββββͺβββββββͺβββββββͺβββββββͺββββββββͺββββββββͺββββββββͺβββββββββͺβββββββββ‘
β acm,lop,unr(0) β 4 β 8 β 24 β 10 β 18 β 42 β 114 β 162 β 344 β 708 β 2,006 β 4,308 β 11,334 β 22,052 β
βββββββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββ€
β acm,lop,unr(8),var(1) β 4 β 8 β 24 β 20 β 44 β 104 β 204 β 360 β 818 β 1,590 β 3,204 β 6,856 β 14,848 β 32,104 β
βββββββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββ€
β ratio (max / min) β 1 β 1 β 1 β 2 β 2.4 β 2.5 β 1.8 β 2.2 β 2.4 β 2.2 β 1.6 β 1.6 β 1.3 β 1.5 β
βββββββββββββββββββββββββ΄βββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄βββββββ΄βββββββ΄βββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄βββββββββ΄βββββββββ
Prefer 8 accumulators.
βββββββββββββββββββββββββ¬ββββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬βββββββ¬βββββββ¬βββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬βββββββββ¬βββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββββββͺββββββͺβββββͺβββββͺββββββͺββββββͺββββββͺβββββββͺβββββββͺβββββββͺββββββββͺββββββββͺββββββββͺβββββββββͺβββββββββ‘
β acm,lop,unr(8),var(1) β 6 β 10 β 26 β 22 β 44 β 104 β 202 β 362 β 802 β 1,588 β 3,094 β 6,290 β 14,056 β 29,776 β
βββββββββββββββββββββββββΌββββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββ€
β acm,lop,unr(8),var(8) β 8 β 10 β 26 β 10 β 18 β 46 β 90 β 162 β 300 β 628 β 1,588 β 3,448 β 8,450 β 19,596 β
βββββββββββββββββββββββββΌββββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββΌβββββββββ€
β ratio (max / min) β 1.3 β 1 β 1 β 2.2 β 2.4 β 2.3 β 2.2 β 2.2 β 2.7 β 2.5 β 1.9 β 1.8 β 1.7 β 1.5 β
βββββββββββββββββββββββββ΄ββββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄βββββββ΄βββββββ΄βββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄βββββββββ΄βββββββββ
Tie up to 4096 lengths.
Prefer 16 accumulators over 4096 lengths.
βββββββββββββββββββββββββββ¬βββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬βββββββ¬βββββββ¬βββββββ¬βββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬βββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββββββββͺβββββͺβββββͺβββββͺββββββͺββββββͺββββββͺβββββββͺβββββββͺβββββββͺβββββββͺββββββββͺββββββββͺββββββββͺβββββββββ‘
β acm,lop,unr(8),var(8) β 6 β 6 β 22 β 12 β 30 β 54 β 90 β 152 β 280 β 622 β 1,918 β 3,576 β 8,648 β 20,598 β
βββββββββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββ€
β acm,lop,unr(16),var(16) β 2 β 6 β 22 β 30 β 22 β 56 β 120 β 168 β 280 β 584 β 1,386 β 3,126 β 7,734 β 19,144 β
βββββββββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββ€
β ratio (max / min) β 3 β 1 β 1 β 2.5 β 1.4 β 1 β 1.3 β 1.1 β 1 β 1.1 β 1.4 β 1.1 β 1.1 β 1.1 β
βββββββββββββββββββββββββββ΄βββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄βββββββ΄βββββββ΄βββββββ΄βββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄βββββββββ
Prefer no unrolling up to 1024 lengths.
Prefer unrolling with 16 accumulators over 1024 lengths.
βββββββββββββββββββββββββ¬βββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬βββββββ¬βββββββ¬βββββββ¬βββββββ¬ββββββββ¬ββββββββ¬βββββββββ¬βββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββββββͺβββββͺβββββͺβββββͺββββββͺββββββͺββββββͺβββββββͺβββββββͺβββββββͺβββββββͺββββββββͺββββββββͺβββββββββͺβββββββββ‘
β acm,lop,unr(0) β 4 β 8 β 24 β 10 β 26 β 42 β 96 β 178 β 442 β 634 β 1,974 β 4,366 β 10,238 β 22,388 β
βββββββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌβββββββββΌβββββββββ€
β acm,lop,unr(8),var(8) β 4 β 8 β 24 β 10 β 26 β 66 β 86 β 176 β 288 β 622 β 1,594 β 3,574 β 9,072 β 20,140 β
βββββββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌβββββββββΌβββββββββ€
β ratio (max / min) β 1 β 1 β 1 β 1 β 1 β 1.6 β 1.1 β 1 β 1.5 β 1 β 1.2 β 1.2 β 1.1 β 1.1 β
βββββββββββββββββββββββββ΄βββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄βββββββ΄βββββββ΄βββββββ΄βββββββ΄ββββββββ΄ββββββββ΄βββββββββ΄βββββββββ
Prefer no unrolling up to 4096 lengths.
Prefer unrolling with 16 accumulators over 4096 lengths.
βββββββββββββββββββββββββββ¬βββββ¬βββββ¬βββββ¬ββββββ¬ββββββ¬ββββββ¬βββββββ¬βββββββ¬βββββββ¬βββββββ¬ββββββββ¬ββββββββ¬ββββββββ¬βββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββββββββͺβββββͺβββββͺβββββͺββββββͺββββββͺββββββͺβββββββͺβββββββͺβββββββͺβββββββͺββββββββͺββββββββͺββββββββͺβββββββββ‘
β acm,lop,unr(0) β 6 β 6 β 22 β 8 β 26 β 40 β 90 β 164 β 342 β 660 β 1,960 β 4,324 β 9,646 β 22,788 β
βββββββββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββ€
β acm,lop,unr(16),var(16) β 2 β 6 β 22 β 30 β 26 β 78 β 132 β 184 β 292 β 588 β 1,586 β 2,954 β 7,222 β 19,378 β
βββββββββββββββββββββββββββΌβββββΌβββββΌβββββΌββββββΌββββββΌββββββΌβββββββΌβββββββΌβββββββΌβββββββΌββββββββΌββββββββΌββββββββΌβββββββββ€
β ratio (max / min) β 3 β 1 β 1 β 3.8 β 1 β 2 β 1.5 β 1.1 β 1.2 β 1.1 β 1.2 β 1.5 β 1.3 β 1.2 β
βββββββββββββββββββββββββββ΄βββββ΄βββββ΄βββββ΄ββββββ΄ββββββ΄ββββββ΄βββββββ΄βββββββ΄βββββββ΄βββββββ΄ββββββββ΄ββββββββ΄ββββββββ΄βββββββββ
Prefer single thread, single accumulator.
βββββββββββββββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬ββββββββββ¬ββββββββββ¬ββββββββββ¬ββββββββββ¬ββββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
βββββββββββββββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺββββββββββͺββββββββββͺββββββββββͺββββββββββͺββββββββββ‘
β acm,lop,unr(0) β 6 β 12 β 26 β 12 β 20 β 44 β 88 β 168 β 420 β 664 β 1,790 β 4,518 β 10,108 β 22,222 β
βββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββΌββββββββββΌββββββββββΌββββββββββΌββββββββββ€
β acm,pll(2),var(2) β 34,702 β 36,512 β 36,224 β 37,452 β 41,914 β 39,452 β 42,320 β 44,202 β 45,132 β 159,180 β 168,724 β 213,796 β 239,166 β 395,640 β
βββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββΌββββββββββΌββββββββββΌββββββββββΌββββββββββ€
β ratio (max / min) β 5,783 β 3,042 β 1,393 β 3,121 β 2,095 β 896 β 480 β 263 β 107 β 239 β 94 β 47 β 23 β 17 β
βββββββββββββββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄ββββββββββ΄ββββββββββ΄ββββββββββ΄ββββββββββ΄ββββββββββ
Prefer single thread, unroll 2, 2 accumulator.
ββββββββββββββββββββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬ββββββββββ¬βββββββββ¬ββββββββββ¬ββββββββββ¬ββββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
ββββββββββββββββββββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺββββββββββͺβββββββββͺββββββββββͺββββββββββͺββββββββββ‘
β acm,lop,unr(2),var(2) β 6 β 10 β 12 β 12 β 22 β 74 β 140 β 268 β 542 β 1,062 β 2,174 β 4,576 β 14,596 β 23,670 β
ββββββββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββΌβββββββββΌββββββββββΌββββββββββΌββββββββββ€
β acm,mpsc,pll(2),var(2) β 23,058 β 26,994 β 19,186 β 16,060 β 14,092 β 13,152 β 13,194 β 13,116 β 11,250 β 107,456 β 44,952 β 130,378 β 202,186 β 196,820 β
ββββββββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββΌβββββββββΌββββββββββΌββββββββββΌββββββββββ€
β ratio (max / min) β 3,843 β 2,699 β 1,598 β 1,338 β 640 β 177 β 94 β 48 β 20 β 101 β 20 β 28 β 13 β 8.3 β
ββββββββββββββββββββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄ββββββββββ΄βββββββββ΄ββββββββββ΄ββββββββββ΄ββββββββββ
Prefer mspc during multi-threading.
ββββββββββββββββββββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬ββββββββββ¬ββββββββββ¬ββββββββββ¬ββββββββββ¬ββββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
ββββββββββββββββββββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺββββββββββͺββββββββββͺββββββββββͺββββββββββͺββββββββββ‘
β acm,join,pll(2),var(2) β 76,932 β 78,054 β 78,868 β 78,562 β 78,140 β 76,442 β 78,434 β 79,352 β 89,660 β 139,852 β 221,310 β 213,838 β 288,378 β 293,264 β
ββββββββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββΌββββββββββΌββββββββββΌββββββββββΌββββββββββ€
β acm,mpsc,pll(2),var(2) β 16,432 β 16,742 β 16,768 β 23,030 β 18,740 β 16,498 β 17,462 β 14,876 β 22,480 β 31,332 β 82,010 β 106,762 β 169,888 β 253,878 β
ββββββββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββΌββββββββββΌββββββββββΌββββββββββΌββββββββββ€
β ratio (max / min) β 4.7 β 4.7 β 4.7 β 3.4 β 4.2 β 4.6 β 4.5 β 5.3 β 4 β 4.5 β 2.7 β 2 β 1.7 β 1.2 β
ββββββββββββββββββββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄ββββββββββ΄ββββββββββ΄ββββββββββ΄ββββββββββ΄ββββββββββ
Either. Based on array length.
ββββββββββββββββββββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬ββββββββββ¬ββββββββββ¬ββββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
ββββββββββββββββββββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺββββββββββͺββββββββββͺββββββββββ‘
β acm,mpsc,pll(2),var(2) β 22,506 β 26,326 β 36,808 β 14,416 β 13,962 β 14,016 β 10,624 β 13,084 β 14,474 β 19,966 β 90,878 β 165,690 β 169,274 β 229,682 β
ββββββββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββΌββββββββββΌββββββββββ€
β acm,mpsc,pll(4),var(4) β 16,736 β 17,966 β 16,780 β 16,360 β 16,634 β 17,964 β 20,088 β 19,064 β 24,506 β 68,304 β 75,174 β 104,700 β 141,570 β 176,032 β
ββββββββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββΌββββββββββΌββββββββββ€
β ratio (max / min) β 1.3 β 1.5 β 2.2 β 1.1 β 1.2 β 1.3 β 1.9 β 1.5 β 1.7 β 3.4 β 1.2 β 1.6 β 1.2 β 1.3 β
ββββββββββββββββββββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄ββββββββββ΄ββββββββββ΄ββββββββββ
Prefer single thread, single accumulator.
ββββββββββββββββββββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬ββββββββββ¬ββββββββββ¬ββββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
ββββββββββββββββββββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺββββββββββͺββββββββββͺββββββββββ‘
β acm,lop,unr(0) β 4 β 8 β 24 β 10 β 18 β 40 β 114 β 162 β 312 β 690 β 1,838 β 4,194 β 9,516 β 21,652 β
ββββββββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββΌββββββββββΌββββββββββ€
β acm,mpsc,pll(4),var(4) β 21,540 β 18,648 β 19,180 β 16,006 β 16,184 β 19,348 β 20,046 β 21,188 β 20,478 β 26,048 β 97,520 β 107,120 β 137,950 β 176,004 β
ββββββββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββΌββββββββββΌββββββββββ€
β ratio (max / min) β 5,385 β 2,331 β 799 β 1,600 β 899 β 483 β 175 β 130 β 65 β 37 β 53 β 25 β 14 β 8.1 β
ββββββββββββββββββββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄ββββββββββ΄ββββββββββ΄ββββββββββ
Prefer 4 threads, 4 accumulators.
ββββββββββββββββββββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬ββββββββββ¬ββββββββββ¬ββββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
ββββββββββββββββββββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺββββββββββͺββββββββββͺββββββββββ‘
β acm,mpsc,pll(4),var(4) β 17,502 β 18,440 β 15,356 β 15,318 β 22,854 β 21,888 β 19,370 β 21,734 β 25,494 β 31,432 β 50,824 β 102,810 β 153,184 β 189,592 β
ββββββββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββΌββββββββββΌββββββββββ€
β acm,mpsc,pll(8),var(8) β 42,524 β 34,378 β 77,716 β 83,572 β 37,062 β 26,914 β 31,024 β 25,520 β 25,710 β 28,488 β 35,308 β 102,234 β 97,490 β 195,394 β
ββββββββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββΌββββββββββΌββββββββββ€
β ratio (max / min) β 2.4 β 1.9 β 5.1 β 5.5 β 1.6 β 1.2 β 1.6 β 1.2 β 1 β 1.1 β 1.4 β 1 β 1.6 β 1 β
ββββββββββββββββββββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄ββββββββββ΄ββββββββββ΄ββββββββββ
Prefer 16 threads. Based on array length.
ββββββββββββββββββββββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬βββββββββ¬ββββββββββ
β len β 16 β 32 β 64 β 128 β 256 β 512 β 1024 β 2048 β 4096 β 8192 β 16384 β 32768 β 65536 β 131072 β
ββββββββββββββββββββββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺβββββββββͺββββββββββ‘
β acm,mpsc,pll(8),var(8) β 92,006 β 65,698 β 38,986 β 62,264 β 78,024 β 26,742 β 23,334 β 24,964 β 27,164 β 31,152 β 35,682 β 86,152 β 91,126 β 193,204 β
ββββββββββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββ€
β acm,mpsc,pll(16),var(16) β 37,610 β 29,558 β 31,118 β 33,060 β 32,712 β 33,690 β 33,050 β 34,400 β 47,812 β 36,602 β 45,736 β 48,402 β 68,382 β 123,410 β
ββββββββββββββββββββββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌβββββββββΌββββββββββ€
β ratio (max / min) β 2.4 β 2.2 β 1.3 β 1.9 β 2.4 β 1.3 β 1.4 β 1.4 β 1.8 β 1.2 β 1.3 β 1.8 β 1.3 β 1.6 β
ββββββββββββββββββββββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄βββββββββ΄ββββββββββ
Why my Rust benchmarks were wrong, or how to correctly use std::hint::black_box?
Counting exactly the number of distinct elements: sorted arrays vs. hash sets?
Counting CPU cycles Daniel Lemire, C code: RDTSC_START
, RDTSC_STOP
RDTSC β Read Time-Stamp Counter
Emit assembly code from Rust:
cargo rustc -- --emit asm
- Read assembly file
target/debug/deps/mtr-44866ab166973511.s
.
.
βββ build.rs
βββ Cargo.lock
βββ Cargo.toml
βββ LICENSE
βββ README.md
βββ src
βββ main.rs
2 directories, 6 files