Git Product home page Git Product logo

rspec-benchmark's Introduction

RSpec::Benchmark

Gem Version Actions CI Build status Code Climate Coverage Status Inline docs

Performance testing matchers for RSpec to set expectations on speed, resources usage and scalability.

RSpec::Benchmark is powered by:

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 section helpful.

Contents

Installation

Add this line to your application's Gemfile:

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:

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:

RSpec.describe "Performance testing" do
  include RSpec::Benchmark::Matchers
end

Then you're good to start setting performance expectations:

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.

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:

expect { ... }.to perform_under(10).ms
expect { ... }.to perform_under(10000).us

By default the above code will be sampled only once but you can change this by using the sample matcher like so:

expect { ... }.to perform_under(0.01).sample(10) # repeats measurements 10 times

For extra expressiveness you can use times:

expect { ... }.to perform_under(0.01).sample(10).times

You can also use warmup matcher that can run your code before the actual samples are taken to reduce erratic execution times.

For example, you can execute code twice before you take 10 actual measurements:

expect { ... }.to perform_under(0.01).sec.warmup(2).times.sample(10).times

1.2 Iterations

The perform_at_least matcher allows you to establish performance benchmark of how many iterations per second a given block of code should perform. For example, to expect a given code to perform at least 10K iterations per second do:

expect { ... }.to perform_at_least(10000).ips

The ips part is optional but its usage clarifies the intent.

The performance timing of this matcher can be tweaked using the within and warmup matchers. These are expressed as seconds.

By default within matcher is set to 0.2 second and warmup matcher to 0.1 respectively. To change how long measurements are taken, for example, to double the time amount do:

expect { ... }.to perform_at_least(10000).within(0.4).warmup(0.2).ips

The higher values for within and warmup the more accurate average readings and more stable tests at the cost of longer test suite overall runtime.

1.3 Comparison

The perform_faster_than and perform_slower_than matchers allow you to test performance of your code compared with other. For example:

expect { ... }.to perform_faster_than { ... }
expect { ... }.to perform_slower_than { ... }

And if you want to compare how much faster or slower your code is do:

expect { ... }.to perform_faster_than { ... }.once
expect { ... }.to perform_faster_than { ... }.twice
expect { ... }.to perform_faster_than { ... }.exactly(5).times
expect { ... }.to perform_faster_than { ... }.at_least(5).times
expect { ... }.to perform_faster_than { ... }.at_most(5).times

expect { ... }.to perform_slower_than { ... }.once
expect { ... }.to perform_slower_than { ... }.twice
expect { ... }.to perform_slower_than { ... }.at_least(5).times
expect { ... }.to perform_slower_than { ... }.at_most(5).times
expect { ... }.to perform_slower_than { ... }.exactly(5).times

The times part is also optional.

The performance timing of each matcher can be tweaked using the within and warmup matchers. These are expressed as seconds. By default within matcher is set to 0.2 and warmup matcher to 0.1 second respectively. To change these matchers values do:

expect { ... }.to perform_faster_than { ... }.within(0.4).warmup(0.2)

The higher values for within and warmup the more accurate average readings and more stable tests at the cost of longer test suite overall runtime.

1.4 Complexity

The perform_constant, perform_logarithmic, perform_linear, perform_power and perform_exponential matchers are useful for estimating the asymptotic behaviour of a given block of code. The most basic way to use the expectations to test how your code scales is to use the matchers:

expect { ... }.to perform_constant
expect { ... }.to perform_logarithmic/perform_log
expect { ... }.to perform_linear
expect { ... }.to perform_power
expect { ... }.to perform_exponential/perform_exp

To test performance in terms of computation complexity you can follow the algorithm:

  1. Choose a method to profile.
  2. Choose workloads for the method.
  3. Describe workloads with input features.
  4. Assert the performance in terms of Big-O notation.

Often, before expectation can be set you need to setup some workloads. To create a range of inputs use the bench_range helper method.

For example, to create a power range of inputs from 8 to 100_000 do:

sizes = bench_range(8, 100_000) # => [8, 64, 512, 4096, 32768, 100000]

Then you can use the sizes to create test data, for example to check Ruby's max performance create array of number arrays.

number_arrays = sizes.map { |n| Array.new(n) { rand(n) } }

Using in_range matcher you can inform the expectation about the inputs. Each range value together with its index will be yielded as arguments to the evaluated block.

You can either specify the range limits:

expect { |n, i|
  number_arrays[i].max
}.to perform_linear.in_range(8, 100_000)

Or use previously generated sizes array:

expect { |n, i|
  number_arrays[i].max
}.to perform_linear.in_range(sizes)

This example will generate and yield input n and index i pairs [8, 0], [64, 1], [512, 2], [4K, 3], [32K, 4] and [100K, 5] respectively.

By default the range will be generated using ratio of 8. You can change this using ratio matcher:

expect { |n, i|
  number_arrays[i].max
}.to perform_linear.in_range(8, 100_000).ratio(2)

The performance measurements for a code block are taken only once per range input. You can increase the stability of your performance test by using the sample matcher. For example, to repeat measurements 100 times for each range input do:

expect { |n, i|
  number_arrays[i].max
}.to perform_linear.in_range(8, 100_000).ratio(2).sample(100).times

The overall quality of the performance trend is assessed using a threshold value where 0 means a poor fit and 1 a perfect fit. By default this value is configured to 0.9 as a 'good enough' threshold. To change this use threshold matcher:

expect { |n, i|
  number_arrays[i].max
}.to perform_linear.in_range(8, 100_000).threshold(0.95)

1.5 Allocation

The perform_allocation matcher checks how much memory or objects have been allocated during a piece of Ruby code execution.

By default the matcher verifies the number of object allocations. The specified number serves as the upper limit of allocations, so your tests won't become brittle as different Ruby versions change internally how many objects are allocated for some operations.

Note that you can also check for memory allocation using the bytes matcher.

To check number of objects allocated do:

expect {
  ["foo", "bar", "baz"].sort[1]
}.to perform_allocation(3)

You can also be more granular with your object allocations and specify which object types you're interested in:

expect {
  _a = [Object.new]
  _b = {Object.new => 'foo'}
}.to perform_allocation({Array => 1, Object => 2}).objects

And you can also check how many objects are left when expectation finishes to ensure that GC is able to collect them.

expect {
  ["foo", "bar", "baz"].sort[1]
}.to perform_allocation(3).and_retain(3)

You can also set expectations on the memory size. In this case the memory size will serve as upper limit for the expectation:

expect {
  _a = [Object.new]
  _b = {Object.new => 'foo'}
}.to perform_allocation({Array => 40, Hash => 384, Object => 80}).bytes

2. Compounding

All the matchers can be used in compound expressions via and/or. For example, if you wish to check if a computation performs under certain time boundary and iterates at least a given number do:

expect {
  ...
}.to perform_under(6).ms and perform_at_least(10000).ips

3. Configuration

By default the following configuration is used:

RSpec::Benchmark.configure do |config|
  config.run_in_subprocess = false
  config.disable_gc = false
end

3.1. :disable_gc

By default all tests are run with GC enabled. We want to measure real performance or Ruby code. However, disabling GC may lead to much quicker test execution. You can change this setting:

RSpec::Benchmark.configure do |config|
  config.disable_gc = true
end

3.2 :run_in_subprocess

The perform_under matcher can run all the measurements in the subprocess. This will increase isolation from other processes activity. However, the rspec-rails gem runs all tests in transactions. Unfortunately, when running tests in child process, database connections are used from connection pool and no data can be accessed. This is only a problem when running specs in Rails. Any other Ruby project can run specs using subprocesses. To enable this behaviour do:

RSpec::Benchmark.configure do |config|
  config.run_in_subprocess = true
end

3.3 :samples

The perform_under and computational complexity matchers allow to specify how many times to repeat measurements. You configure it globally for all matchers using the :samples option which defaults to 1:

RSpec::Benchmark.configure do |config|
  config.samples = 10
end

3.4 :format

The perform_at_least matcher uses the :format option to format the number of iterations when a failure message gets displayed. By default, the :human values is used to make numbers more readable. For example, the 12300 i/s gets turned into 12.3k i/s. If you rather have an exact numbers presented do:

RSpec::Benchmark.configure do |config|
  config.format = :raw
end

4. Filtering

Usually performance tests are best left for CI or occasional runs that do not affect TDD/BDD cycle.

To achieve isolation you can use RSpec filters to exclude performance tests from regular runs. For example, in spec_helper:

RSpec.config do |config|
  config.filter_run_excluding perf: true
end

And then in your example group do:

RSpec.describe ..., :perf do
  ...
end

Then you can run groups or examples tagged with perf:

rspec --tag perf

Another option is to simply isolate the performance specs in separate directory such as spec/performance/... and add custom rake task to run them.

5. Caveats

When writing performance tests things to be mindful are:

  • The tests may potentially be flaky thus its best to use sensible boundaries:
    • too strict boundaries may cause false positives, making tests fail
    • too relaxed boundaries may also lead to false positives missing actual performance regressions
  • Generally performance tests will be slow, but you may try to avoid unnecessarily slow tests by choosing smaller maximum value for sampling

If you have any other observations please share them!

Contributing

  1. Fork it ( https://github.com/piotrmurach/rspec-benchmark/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Code of Conduct

Everyone interacting in the Strings projectโ€™s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Copyright

Copyright (c) 2016 Piotr Murach. See LICENSE for further details.

rspec-benchmark's People

Contributors

edgartheunready avatar jandintel avatar julianrubisch avatar olleolleolle avatar piotrmurach avatar rimian avatar sondnm avatar wilddima avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rspec-benchmark's Issues

marshal data too short

Hello,

I came across this issue while writing a test:

ArgumentError:
       marshal data too short
     # /Users/sebastianjimenez/.rvm/gems/ruby-2.3.1@business-tool/gems/activesupport-4.2.7.1/lib/active_support/core_ext/marshal.rb:6:in `load'
     # /Users/sebastianjimenez/.rvm/gems/ruby-2.3.1@business-tool/gems/activesupport-4.2.7.1/lib/active_support/core_ext/marshal.rb:6:in `load_with_autoloading'
     # /Users/sebastianjimenez/.rvm/gems/ruby-2.3.1@business-tool/gems/benchmark-perf-0.1.0/lib/benchmark/perf/execution_time.rb:64:in `run_in_subprocess'
     # /Users/sebastianjimenez/.rvm/gems/ruby-2.3.1@business-tool/gems/benchmark-perf-0.1.0/lib/benchmark/perf/execution_time.rb:98:in `block in run'
     # /Users/sebastianjimenez/.rvm/gems/ruby-2.3.1@business-tool/gems/activesupport-4.2.7.1/lib/active_support/core_ext/range/each.rb:7:in `each'
     # /Users/sebastianjimenez/.rvm/gems/ruby-2.3.1@business-tool/gems/activesupport-4.2.7.1/lib/active_support/core_ext/range/each.rb:7:in `each_with_time_with_zone'
     # /Users/sebastianjimenez/.rvm/gems/ruby-2.3.1@business-tool/gems/benchmark-perf-0.1.0/lib/benchmark/perf/execution_time.rb:95:in `run'
     # /Users/sebastianjimenez/.rvm/gems/ruby-2.3.1@business-tool/gems/rspec-benchmark-0.1.0/lib/rspec/benchmark/timing_matcher.rb:38:in `matches?'
     # /Users/sebastianjimenez/.rvm/gems/ruby-2.3.1@business-tool/gems/rspec-expectations-3.5.0/lib/rspec/expectations/handler.rb:50:in `block in handle_matcher'
     # /Users/sebastianjimenez/.rvm/gems/ruby-2.3.1@business-tool/gems/rspec-expectations-3.5.0/lib/rspec/expectations/handler.rb:27:in `with_matcher'
     # /Users/sebastianjimenez/.rvm/gems/ruby-2.3.1@business-tool/gems/rspec-expectations-3.5.0/lib/rspec/expectations/handler.rb:48:in `handle_matcher'
     # /Users/sebastianjimenez/.rvm/gems/ruby-2.3.1@business-tool/gems/rspec-expectations-3.5.0/lib/rspec/expectations/expectation_target.rb:65:in `to'
     # /Users/sebastianjimenez/.rvm/gems/ruby-2.3.1@business-tool/gems/rspec-expectations-3.5.0/lib/rspec/expectations/expectation_target.rb:101:in `to'

Basically I'm passing a block where I'm calling the method I want to benchmark like this:

it "should perform under 1 sec" do
  expect { subject.pricing }.to perform_under(1).sec
end

Is there anything I'm missing?

Thanks in advance

FloatDomainError

Are you in the right place?

  • For issues or feature requests file a GitHub issue in this repository
  • For general questions or discussion post on StackOverflow

Describe the problem

NaN (FloatDomainError)

Steps to reproduce the problem

This is hard to reproduce as I have no idea why it just happens for specific code. Though the error is happening in lib/rspec/benchmark/iteration_matcher.rb:77:in '%'

Actual behaviour

NaN (FloatDomainError) is raised

Expected behaviour

Work ๐Ÿ˜„

Describe your environment

  • OS version: Darwin 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64
  • Ruby version: ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18]
  • RSpec version: rspec (3.8.0)
  • RSpec::Benchmark version: rspec (3.8.0)

LocalJumpError: no block given (yield)

Describe the problem

Warmup and within helpers do not work

expect { create(:assigned_tag) }.to perform_faster_than.within(0.4).warmup(0.2) { AssignedTag.create }
# => LocalJumpError: no block given (yield)
# => from /bundle/gems/benchmark-perf-0.6.0/lib/benchmark/perf/iteration.rb:25:in `call_times'

Expected behaviour

to warm up CPU and execute the test without errors

Describe your environment

  • OS version: Mac OS 10.15.6
  • Ruby version: 2.6.3
  • RSpec version: 4.0.1
  • RSpec::Benchmark version: 0.6.0

Database empty while timing block

Describe the problem

Follow up from #6. Test data cannot be found in the database when using the expect { }.to perform_under() matcher.

Steps to reproduce the problem

Sample repo can be found here: https://github.com/tjwallace/rspec-benchmark-bug

git clone https://github.com/tjwallace/rspec-benchmark-bug.git
cd rspec-benchmark-bug
bundle install
rake db:migrate
rake spec

Actual behaviour

An ActiveRecord::RecordNotFound exception is thrown.

Expected behaviour

The record should be found.

Describe your environment

  • OS version: OSX 10.11.6
  • Ruby version: 2.5.1
  • RSpec version: 3.8
  • RSpec::Benchmark version: 0.4.0

EOF end of file reached

Describe the problem

I get this error:

     Failure/Error: expect { 1000.times { subject.update_transactions_for(payment) } }.to perform_under(50).ms

     EOFError:
       end of file reached
     # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/benchmark-perf-0.4.0/lib/benchmark/perf/execution_time.rb:50:in `load'
     # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/benchmark-perf-0.4.0/lib/benchmark/perf/execution_time.rb:50:in `run_in_subprocess'
     # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/benchmark-perf-0.4.0/lib/benchmark/perf/execution_time.rb:65:in `block in run_warmup'
     # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/benchmark-perf-0.4.0/lib/benchmark/perf/execution_time.rb:64:in `times'
     # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/benchmark-perf-0.4.0/lib/benchmark/perf/execution_time.rb:64:in `run_warmup'
     # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/benchmark-perf-0.4.0/lib/benchmark/perf/execution_time.rb:87:in `run'
     # /Users/mhluska/.rvm/gems/ruby-2.5.1/gems/rspec-benchmark-0.4.0/lib/rspec/benchmark/timing_matcher.rb:42:in `matches?'
     # ./spec/acceptance/commands/payment_processor_spec.rb:16:in `block (3 levels) in <top (required)>

Steps to reproduce the problem

My RSpec test:

require 'active_record'
require 'cryptocoin_payable/commands/payment_processor'
require 'cryptocoin_payable/coin_payment'

describe CryptocoinPayable::PaymentProcessor do
  context 'when testing performance of database operations' do
    before(:all) { GC.disable }
    after(:all) { GC.enable }

    before do
      ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'spec/dummy/db/test.sqlite3')
    end

    it 'should update transactions 1000 times in under 50ms' do
      payment = CryptocoinPayable::CoinPayment.new(address: '3HR9xYD7MybbE7JLVTjwijYse48BtfEKni', coin_type: :btc)
      expect { 1000.times { subject.update_transactions_for(payment) } }.to perform_under(50).ms
    end
  end
end

To run this code:

git clone [email protected]:Sailias/cryptocoin_payable.git
cd cryptocoin_payable
git checkout use-bulk-insertion
git pull
bundle install
rspec

Actual behaviour

EOFError raised

Expected behaviour

Timing results returned.

Describe your environment

  • OS version: Mac High Sierra 10.13.6
  • Ruby version: Tried 2.4.0 and 2.5.1
  • RSpec version: 3.7.0
  • RSpec::Benchmark version: 3.7.0

Implement a `perform_allocation_under` matcher

Hi Piotr, thanks for this awesome tool. I have a little feature request though.

I'm profiling the memory allocation of Rails view partials, and I'd like to be able to state in a spec that a partial must not allocate more than X objects - mainly to track when anyone adds code that massively increases allocations.

Is there a way to do this currently, or would you have to implement another matcher?

perform_under is run several times

I have to do performance test of service for create user, but it's always return raise error because of duplicate record (create method)

I thought sample was default run once. but I don't get it why it run more than 1.

my code

it 'is expected to run under 100ms', :performance_test_1 do
    expect { subject.execute }.to perform_under(5).ms
end

it runs the code more than 1 so i always failed the performance test because duplicated record

Describe your environment

  • OS version:
  • Ruby version: 3.0.3
  • RSpec::Benchmark version: 0.6.0

Failure message appears to contradict itself

Describe the problem

When executing a spec using the power matcher I receive an error that appears to be contradictory.

Steps to reproduce the problem

Create a spec that uses the perform_power matcher.

Your code here to reproduce the issue

      it "tests complexity" do
        expect{request}.to perform_power
      end

Actual behaviour

What happened? This could be a description, log output, error raised etc.

     Failure/Error: expect{request}.to perform_power
       expected block to perform power, but performed power

Expected behaviour

What did you expect to happen?
A passing test or a failing test stating the request did not perform power

Describe your environment

  • OS version: macOS Big Sur 11.6
  • Ruby version: 2.7.4
  • RSpec::Benchmark version: rspec-benchmark (0.6.0)

some examples in Readme are failing

Describe the problem

I am learning this gem and tried the examples in the README.
And just wann know if this is either:

  • a configuration issue on my side
  • a typo in the docs
  • a bug

Steps to reproduce the problem

    it "how many objects are left" do
      #  And you can also check how many objects are left when expectation finishes to ensure that GC is able to collect them.
      expect { ["foo", "bar", "baz"].sort[1] }.to perform_allocation(3).and_retain(3)
    end

    it "perform_constant" do
      sizes = bench_range(8, 100_000) # => [8, 64, 512, 4096, 32768, 100000]
      number_arrays = sizes.map { |n| Array.new(n) { rand(n) } }
      expect { |n, i| number_arrays[i].max }.to perform_linear.in_range(8, 100_000).ratio(2)
    end

Actual behaviour

expected block to perform allocation of 3 objects and retain 3 objects, but allocated 6 objects and retained 6

  0) Performance testing examples Allocation how many objects are left
     Failure/Error: expect { ["foo", "bar", "baz"].sort[1] }.to perform_allocation(3).and_retain(3)
       expected block to perform allocation of 3 objects and retain 3 objects, but allocated 6 objects and retained 6
     # ./spec/benchmark/sanity_check_spec.rb:135:in `block (3 levels) in <top (required)>'
     # ./spec/rails_helper.rb:115:in `block (3 levels) in <top (required)>'
     # ./spec/rails_helper.rb:114:in `block (2 levels) in <top (required)>'


NoMethodError: undefined method `max' for nil:NilClass

  0) Performance testing examples Complexity perform_constant
     Failure/Error: expect { |n, i| number_arrays[i].max }.to perform_linear.in_range(8, 100_000).ratio(2)

     NoMethodError:
       undefined method `max' for nil:NilClass
     # ./spec/benchmark/sanity_check_spec.rb:115:in `block (4 levels) in <top (required)>'
     # ./spec/benchmark/sanity_check_spec.rb:115:in `block (3 levels) in <top (required)>'
     # ./spec/rails_helper.rb:115:in `block (3 levels) in <top (required)>'
     # ./spec/rails_helper.rb:114:in `block (2 levels) in <top (required)>'

Expected behaviour

Go green

Describe your environment

  • OS version: 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64
  • Ruby version: ruby '2.7.2'
  • RSpec::Benchmark version: rspec-benchmark (0.6.0)

.and_sample(n) does't work as expected

Describe the problem

.and_sample(n) does't work as expected as n < 3

Steps to reproduce the problem

See https://github.com/vochicong/csv_step_importer_sample/blob/master/spec/performance/book_importer_spec.rb#L15

Actual behaviour

  • .and_sample(n) doesn't work for n = 1, 2, it will run 3 times
  • .and_sample(-1) seems to run once, but sometimes it seems to run 3 times.

Expected behaviour

  • Default sample to be 1
  • .and_sample(n) work for n < 3

Describe your environment

  • OS version: CircleCI
  • Ruby version: 2.4
  • RSpec version: 3.8
  • RSpec::Benchmark version: 0.3

Database content empty for second run

Hi, please close this issue if this is something obvious too everyone but me.

I added the gem to my Rails app trying to benchmark some recursive updates to my records.
I setup everything and it worked. Then I created records in my database for the recursive update.
I created the expect { foo.bar }.to perform_under(1).sec.and_sample(2) expectation. (I wanted to start slowly to establish a baseline from where to measure and improve.)

I noticed that the database was cleaned on the second sample and the recursive updates couldn't be run. I couldn't fid anything in your Readme or see where in the code this happens.

Did I do something wrong?
When I create the records inside the performance expectations block, it works.

Does that make sense? Should I show you with some pseudo code what my test looked like?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.