使用bundle exec运行脚本很慢

时间:2012-12-15 18:31:21

标签: ruby-on-rails ruby-on-rails-3 bundler

使用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,它的速度很慢&花费两倍的时间。

所以,只是我或bundle exec只是慢?

1 个答案:

答案 0 :(得分:2)

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

  

所以不要在rails命令之前运行bundle exec,这个命令已经存在了   了解Bundler并根据您所拥有的内容设置所有内容   你的Gemfile。如果您在rails命令之前预先添加bundle exec   将添加是从Bundler打开另一个进程的开销   执行无用的代码,因为rails已经做了正确的事情。

来自here

相关问题