当我使用 just 运行我的规范时spork
,我得到了相当显着的性能提升
$ time rspec .
.....
Finished in 11.39 seconds
5 examples, 0 failures
real 0m11.780s
user 0m10.318s
sys 0m1.180s
和spork
$ time rspec . --drb
.....
Finished in 107.24 seconds
5 examples, 0 failures
real 0m1.968s
user 0m0.488s
sys 0m0.095s
这真是太棒了。但是一旦我投入了防守,似乎一切都变得如此缓慢,好像根本没有spork。
$ guard
Guard is now watching at '/Users/darth/projects/scvrush'
Starting Spork for RSpec
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
Spork server for RSpec successfully started
Guard::RSpec is running, with RSpec 2!
Running all specs
.....
Finished in 10.77 seconds
5 examples, 0 failures
即使我不看,Finished in 10.77 seconds
每次尝试运行规范时,我至少可以计算 6-8 秒,即使只是一个模型。
我对 Guardfile 做了一些小的编辑,例如:wait => 120
,但这只会影响guard
启动时间。