# fastruby/fast-ruby

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/fastruby-fast-ruby).**

_How this analysis was created: the description and tags below were written by an AI model that read this project's README and public documentation pages; stars, license and language come straight from the GitHub API. The model does not read the source code._

5,741 stars · 368 forks · HTML

## Links

- GitHub: https://github.com/fastruby/fast-ruby
- Homepage: https://github.com/fastruby/fast-ruby
- awesome-repositories: https://awesome-repositories.com/repository/fastruby-fast-ruby.md

## Topics

`benchmark-ips` `hacktoberfest` `performance-optimization` `ruby`

## Description

Fast Ruby is a collection of small, runnable Ruby micro-benchmarks that compare equivalent ways of writing the same code and show which runs faster. Each idiom lives in its own standalone script and is measured in iterations per second. Results are reported as how many times slower each alternative is than the fastest, so the gaps are easy to compare. The scripts double as a reference of faster Ruby idioms, published as a browsable results site alongside the benchmark sources.

Every comparison runs the candidate snippets first and raises an error if their results differ, so the timings only cover code that does the same thing. The same scripts are also run under several Ruby releases and alternative runtimes, including YJIT, ZJIT and JRuby. This shows how the fastest idiom can change from one version or engine to the next.

The benchmarks are grouped by subject: arrays, hashes, strings, enumerable iteration, blocks and procs, method dispatch and metaprogramming, error handling and object creation, and numeric and date parsing. Typical comparisons include hash merging and fetching with defaults, string substitution and prefix checks, loop styles, attribute accessors, frozen versus mutable strings, and ISO 8601 parsing. At build time, the collected benchmark output is converted into a single static HTML page where all the comparisons can be read together.

## Tags

### Programming Languages & Runtimes

- [Ruby Performance Optimization](https://awesome-repositories.com/f/programming-languages-runtimes/ruby-performance-optimization.md) — Provides a curated set of runnable Ruby benchmark scripts comparing equivalent idioms by iterations per second to show which runs faster.
- [Array and Object Idiom Rules](https://awesome-repositories.com/f/programming-languages-runtimes/array-and-object-idiom-rules.md) — Helps developers choose faster ways to write everyday operations on arrays, hashes, strings, blocks, and loops.
- [Cross-Runtime Benchmark Matrices](https://awesome-repositories.com/f/programming-languages-runtimes/cross-runtime-benchmark-matrices.md) — Executes the same benchmark scripts under several Ruby releases and runtimes including YJIT, ZJIT and JRuby to show how the fastest idiom shifts.

### Testing & Quality Assurance

- [Language Idiom Benchmarks](https://awesome-repositories.com/f/testing-quality-assurance/language-idiom-benchmarks.md) — Runs iterations-per-second benchmark reports for alternative implementations of one task and compares them side by side to pick the faster idiom. ([source](https://github.com/fastruby/fast-ruby/blob/main/code/array/length-vs-size-vs-count.rb))
- [Benchmark Equivalence Checks](https://awesome-repositories.com/f/testing-quality-assurance/benchmark-equivalence-checks.md) — Runs every compared snippet first and raises an error if results differ, so timings cover only code that does the same thing. ([source](https://github.com/fastruby/fast-ruby/blob/main/code/array/subset-check.rb))
- [Iterations-Per-Second Benchmark Reports](https://awesome-repositories.com/f/testing-quality-assurance/iterations-per-second-benchmark-reports.md) — Run competing code snippets repeatedly through an iterations-per-second benchmark and print a side-by-side comparison so the faster approach is easy to identify. ([source](https://github.com/fastruby/fast-ruby/blob/main/code/proc-and-block/proc-call-vs-yield.rb))
- [Micro-Benchmark Suites](https://awesome-repositories.com/f/testing-quality-assurance/micro-benchmark-suites.md) — Provides small standalone benchmark scripts that verify compared snippets return identical results before measuring relative speed.
- [Array Operation Benchmarks](https://awesome-repositories.com/f/testing-quality-assurance/array-operation-benchmarks.md) — Benchmarks array tasks like finding, sampling, counting, joining, inserting, sorting, and subset checks to show which methods avoid extra allocations. ([source](https://github.com/fastruby/fast-ruby/blob/main/README.md))
- [Comparative Performance Benchmarking](https://awesome-repositories.com/f/testing-quality-assurance/comparative-performance-benchmarking.md) — Benchmarks several ways to test whether one array contains all elements of another and ranks their relative speed. ([source](https://github.com/fastruby/fast-ruby/blob/main/code/array/subset-check.rb))
- [Equivalence-Checked Benchmark Comparisons](https://awesome-repositories.com/f/testing-quality-assurance/equivalence-checked-benchmark-comparisons.md) — Runs every compared snippet first and raises an error if results differ, so timings only cover code that does the same thing.
- [Iteration Style Benchmarks](https://awesome-repositories.com/f/testing-quality-assurance/iteration-style-benchmarks.md) — Measure looping over collections with indexed each versus while loops, including reading the collection size once before the loop, to show which style runs fastest. ([source](https://github.com/fastruby/fast-ruby/tree/main/code))
- [Iterative Timing Loops](https://awesome-repositories.com/f/testing-quality-assurance/iterative-timing-loops.md) — Runs each idiom repeatedly in a timing loop that reports iterations per second and ranks the variants side by side.

### Education & Learning Resources

- [Performance-Based Idiom Mappings](https://awesome-repositories.com/f/education-learning-resources/comparative-analyses/language-idiom-comparisons/performance-based-idiom-mappings.md) — Ranks common Ruby idioms for strings, arrays, hashes, blocks, and iteration from fastest to slowest with measured speed ratios.

### Development Tools & Productivity

- [Release Performance Comparison](https://awesome-repositories.com/f/development-tools-productivity/version-monitoring/deployed-version-tracking/release-performance-comparison.md) — Runs the same benchmark scripts across Ruby releases and runtimes such as YJIT, ZJIT, and JRuby to show how idiom speed changes.
