my.urgas.eu

RSS

Posts tagged with "rspec"

Speeding up RSpec test suite: Tip #3

Assuming you are using ruby 1.9.3-p0 at the moment, then I suggest applying funny-falcon patch (https://gist.github.com/1688857). This made my rails start up faster and also the overall runtime.

This is also included in the RVM. To install it, just run:

rvm get head
rvm install 1.9.3-falcon
rvm use 1.9.3-falcon

I also suggest adding following to your shell rc file (bonus section from the gist). This basically calms down the garbage collector. It has almost same effect as disabling GC completely in the specs (tip #2).

export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000

Speeding up RSpec test suite: Tip #2

Got lots of RAM? Disable GC.

I have this snippet in my spec_helper.rb

  if ENV["RUBY_DISABLE_GC_FOR_SPECS"]
    config.before(:suite) do
      puts "GC disabled"
      GC.disable
    end
  end

And in my shell rc file I have:

export RUBY_DISABLE_GC_FOR_SPECS="true"

Warning: If you have many selenium tests, then do not disable it completely. You’ll just run out of RAM.