$ time rails runner "puts 1" 1 real 0m14.917s user 0m10.923s sys 0m3.007s[/code]
$ time rspec ./spec/models/asset_spec.rb Finished in 0.02351 seconds real 0m19.014s user 0m13.108s sys 0m3.440s
... so you wait 14seconds for Rails to boot, to run a 0.02 seconds spec. Now try to do it every few minutes.
Guard: Guard is a command line tool to easily handle events on files modifications (FSEvent / Inotify / Polling support). https://github.com/guard/guard
Guard-Spork: https://github.com/guard/guard-spork - reloads Spork on code changes that are cached (like lib/, initializers, etc) Guard-RSpec: https://github.com/guard/guard-rspec - runs specs on code changes (re runs until green, Growl alerts)
So now the 19 seconds are cut down to: ...
$ time rspec ./spec/models/asset_spec.rb Finished in 0.01704 seconds real 0m3.046s user 0m0.400s sys 0m0.116s
Why 3 seconds? Because there are still some things we reload on every run of specs (although this can be probably optimized).
Besides this, you also save time by not having to run specs manually. So guard-rspec is relevant even if you don't have a big Rails project or non Rails project at all.
Spork reloading has its issues (that's the main reason we use Guard along with it). Some useful links that will help you out:
https://gist.github.com/1071387 - My Rails 3 template incorporates many of the tips above and some more. Although a bit outdates.