Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Performance testing matchers for RSpec
| Date | Stars |
|---|---|
| 2026-07-24 | 618 |
| 2026-07-25 | 618 |
| 2026-07-28 | 618 |
| 2026-07-30 | 618 |
| 2026-08-06 | 618 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# RSpec::Benchmark
[][gem]
[][gh_actions_ci]
[][appveyor]
[][codeclimate]
[][coverage]
[][inchpages]
[gem]: https://badge.fury.io/rb/rspec-benchmark
[gh_actions_ci]: https://github.com/piotrmurach/rspec-benchmark/actions?query=workflow%3ACI
[appveyor]: https://ci.appveyor.com/project/piotrmurach/rspec-benchmark
[codeclimate]: https://codeclimate.com/github/piotrmurach/rspec-benchmark
[coverage]: https://coveralls.io/github/piotrmurach/rspec-benchmark
[inchpages]: https://inch-ci.org/github/piotrmurach/rspec-benchmark
> Performance testing matchers for RSpec to set expectations on speed, resources usage and scalability.
**RSpec::Benchmark** is powered by:
* [benchmark-perf](https://github.com/piotrmurach/benchmark-perf) for measuring execution time and iterations per second.
* [benchmark-trend](https://github.com/piotrmurach/benchmark-trend) for estimating computation complexity.
* [benchmark-malloc](https://github.com/piotrmurach/benchmark-malloc) for measuring object and memory allocations.
## Why?
Integration and unit tests ensure that changing code maintains expected functionality. What is not guaranteed is the code changes impact on library performance. It is easy to refactor your way out of fast to slow code.
If you are new to performance testing you may find [Caveats](#5-caveats) section helpful.
## Contents
* [1. Usage](#1-usage)
* [1.1 Timing](#11-timing)
* [1.2 Iterations ](#12-iterations)
* [1.3 Comparison ](#13-comparison)
* [1.4 Complexity](#14-complexity)
* [1.5 Allocation](#15-allocation)
* [2. Compounding](#2-compounding)
* [3. Configuration](#3-configuration)
* [3.1 :disable_gc](#31-disable_gc)
* [3.2 :run_in_subprocess](#32-run_in_subprocess)
* [3.3 :samples](#33-samples)
* [3.4 :format](#34-format)
* [4. Filtering](#4-filtering)
* [5. Caveats](#5-caveats)
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'rspec-benchmark'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install rspec-benchmark
## 1. Usage
For matchers to be available globally, in `spec_helper.rb` do:
```ruby
require 'rspec-benchmark'
RSpec.configure do |config|
config.include RSpec::Benchmark::Matchers
end
```
This will add the following matchers:
* `perform_under` to see how fast your code runs
* `perform_at_least` to see how many iteration per second your code can do
* `perform_(faster|slower)_than` to compare implementations
* `perform_(constant|linear|logarithmic|power|exponential)` to see how your code scales with time
* `perform_allocation` to limit object and memory allocations
These will help you express expected performance benchmark for an evaluated code.
Alternatively, you can add matchers for particular example:
```ruby
RSpec.describe "Performance testing" do
include RSpec::Benchmark::Matchers
end
```
Then you're good to start setting performance expectations:
```ruby
expect {
...
}.to perform_under(6).ms
```
### 1.1 Timing
The `perform_under` matcher answers the question of how long does it take to perform a given block of code on average. The measurements are taken executing the block of code in a child process for accurate CPU times.
```ruby
expect { ... }.to perform_under(0.01).sec
```
All measurements are assumed to be expressed as seconds. However, you can also provide time in `ms`, `us` and `ns`. The equivalent example in `ms` would be:
```ruby
expect { ... }.to perform_under(10).ms
expect { ... }.to perform_under(10000Excerpt of 15,052 characters
Read on GitHub264
10
1
1
1
Olle Jonsson · Auctionet ✨
1
1
1
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:6097fc2c5478badc, topic:benchmark, topic:testing