使用bundle exec运行脚本很慢 [英] running scripts with bundle exec is slow

查看:77
本文介绍了使用bundle exec运行脚本很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与包执行程序一起运行时

When running with bundle exec

$ time bundle exec rails generate model student name:string age:number
      invoke  active_record
      create    db/migrate/20121215170617_create_students.rb
      create    app/models/student.rb

real    0m13.397s
user    0m11.676s
sys     0m0.597s

直接运行

$ time rails generate model student name:string age:number
      invoke  active_record
      create    db/migrate/20121215171018_create_students.rb
      create    app/models/student.rb

real    0m6.408s
user    0m5.783s
sys     0m0.510s

$ ruby -v
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]

因此,正常情况下该命令需要6秒,但使用 bundle exec ,它的&花费两倍的时间。

so, normal the command takes 6seconds but with bundle exec, its slow & takes twice the the time.

那么,仅仅是我还是 bundle exec 太慢了?

so, is just me or bundle exec is just slow?

推荐答案

bundle exec rails 命令一起使用是多余的。

Using bundle exec with rails command is redundant.


所以不要在rails命令之前运行bundle exec,该命令已经
知道了Bundler并根据您在
的Gemfile中拥有什么。如果在rails命令之前将bundle exec放在前面,那么
所要增加的只是从Bundler打开另一个进程的开销,而
执行无用的代码的开销是因为Rails已经做对了。

So don't run bundle exec before rails command, this command is already aware of Bundler and sets up everything according to what you have on your Gemfile. If you prepend bundle exec before rails command all you will be adding is overhead of opening another process from Bundler and executing useless code since rails already does the right thing.

Gotten来自此处

这篇关于使用bundle exec运行脚本很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆