Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is rails bootstrap so slow and what can I do about it?

Rails 3.0 is a serious dog. I've been developing on Rails for 5 years, and it's never been slower to startup. In particular, tests take forever to bootstrap on a top notch MacBook with SSD, so iteration cycles suffer severely. I need to read an article every time I start a test. It's insane and not "agile". I might as well be compiling.

This is the major motivation for me to finally move on from Rails - when I have the chance.

If anyone has a solution, please offer it. I know many people suffer from this problem.

I don't use rspec - I know there is a solution to help with tests for rspec.

I'm using faster_require and rails-dev-boost, but there is no significant impact.

I'm on ruby 1.9.2 and need to be. A single pretty simple controller test takes 26 seconds on a dual core 2.13 Ghz MacBook Air with 4Gb RAM and SSD! Why!?

like image 439
Alex Neth Avatar asked Apr 21 '11 01:04

Alex Neth


1 Answers

Check out spork. It essentially runs a small server which runs the bootstrapping and then waits for test runs, allowing you to bootstrap once and then test many times from that state. You will occasionally have to restart it if you do certain kinds of changes to the configuration, but for the most part it lets you have really fast red-green-refactor iterations.

like image 145
hammar Avatar answered Oct 12 '22 10:10

hammar