Rails 在 ruby​​ 1.9.1 上初始化非常慢 [英] Rails initializes extremely slow on ruby 1.9.1

查看:49
本文介绍了Rails 在 ruby​​ 1.9.1 上初始化非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在 ruby​​ 1.9.1 上运行了 Rails 2.3.8 应用程序.要进入控制台,请启动网络服务器,任何初始化 rails 的操作,在 ruby​​ 1.9 中比在 ruby​​ 1.8.7 中花费的时间长 3 - 4 倍.我正在使用 ruby​​ 版本管理器,因此我可以轻松地在 ruby​​ 1.9 和 ruby​​ 1.8.7 之间切换.速度差异发生在生产和开发中.我想使用 1.9,因为一旦一切都运行起来它必须更快,但是启动时间太糟糕了,应用程序在第一次请求时就在 Heroku 上超时.

I just got my rails 2.3.8 app running on ruby 1.9.1. To get into the console, start the webserver, anything that initializes rails, takes 3 - 4 times longer in ruby 1.9 than in ruby 1.8.7. I'm using ruby version managers so I can easily switch between ruby 1.9 and ruby 1.8.7. The speed difference happens in both production and development. I want to use 1.9 because its must faster once everything is running, but the startup time is so bad the app is timing out on Heroku on the first request.

任何想法为什么 ruby​​ 1.9 会慢 3 - 4 倍?我一辈子都搞不清楚.

Any ideas why ruby 1.9 would be 3 - 4 times slower? I can't figure it out for the life of me.

推荐答案

尝试使用 1.9.2-head 而不是 1.9.1.这是 Rails 的推荐版本3,所以你可能会有更好的运气.根据我刚刚在本地运行的测试(顺便说一下,也安装了 Authlogic),Rails 2.3.8 在 1.9.2-head 上启动得非常快.

Try using 1.9.2-head instead of 1.9.1. It is the recommended version for Rails 3, so you may have better luck. Rails 2.3.8 starts up very quick on 1.9.2-head from the tests I just ran locally (with Authlogic installed too, btw).

如果您使用的是 RVM,请输入以下内容:

If you are using RVM, type the following:

rvm install 1.9.2-head
rvm use 1.9.2-head

我用同一个应用程序尝试了 1.9.1 p378,启动时间大约为 13 秒,而 1.9.2-head 为 5 秒.1.9.2-rc1 将于本月发布 我相信,所以这是个好消息 :)

I tried 1.9.1 p378 with the same app and the start up time took about 13 seconds compared to 5 seconds on 1.9.2-head. 1.9.2-rc1 is due out this month I believe, so that's good news :)

这篇关于Rails 在 ruby​​ 1.9.1 上初始化非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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