为什么我使用 Guard 时的速度这么慢?

发布于 2024-12-12 07:12:09 字数 1039 浏览 0 评论 0原文

当我仅使用 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

确实很棒。但一旦我投入了后卫,一切似乎都运行得很慢,就好像根本没有勺子一样。

$ 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

即使我不看在 10.77 秒内完成,每次尝试运行规范时我都可以算出至少 6-8 秒,即使只是一个模型。

我对 Guardfile 做了一些小幅编辑,例如 :wait => 120,但这应该只影响 guard 启动时。

When I run my specs using just spork, I get quite a significant performance increase

$ time rspec .
.....

Finished in 11.39 seconds
5 examples, 0 failures

real    0m11.780s
user    0m10.318s
sys     0m1.180s

and with spork

$ time rspec . --drb
.....

Finished in 107.24 seconds
5 examples, 0 failures

real    0m1.968s
user    0m0.488s
sys     0m0.095s

which is really awesome. But once I put guard into play, it seems that everything runs so slow, as if there was no spork at all.

$ 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

even if I don't look at the Finished in 10.77 seconds, I can count at least 6-8 seconds every time it tries to run a spec, even for just one model.

I did some minor edits to the Guardfile, such as :wait => 120, but that should only affect when guard is starting up.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

揽月 2024-12-19 07:12:10

您必须在 Guardfile 中为 rspec 传递 --drb 选项,如下所示:

guard 'rspec', :version => 2, :cli => '--drb' do
 ...
end

You have to pass the --drb option for rspec in your Guardfile, like this:

guard 'rspec', :version => 2, :cli => '--drb' do
 ...
end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文