Ruby / Rails在Windows 7上运行缓慢

时间:2021-07-28 00:22:31

I know this is a common topic for questions but I couldn't find any that seemed to answer my question which seemed a little different than most with this topic.

我知道这是一个常见的问题主题,但我找不到任何似乎回答我的问题,这个问题似乎与大多数问题有所不同。

I'm new to Ruby and Ruby on Rails so keep that in mind with this question. Whenever I run bundle, rails, etc. commands either through my IDE (Aptana) or in the Windows command screen, they literally take up to a minute to execute. A bundle install can take 20 seconds to begin printing anything to the screen, rspec commands can take 40 seconds to begin before taking 6 seconds to run tests (an appropriate time for this case). Rails server can take 40 seconds to start.

我是Ruby和Ruby on Rails的新手,所以请记住这个问题。每当我通过我的IDE(Aptana)或Windows命令屏幕运行bundle,rails等命令时,它们实际上需要一分钟才能执行。捆绑安装可能需要20秒才能开始向屏幕打印任何内容,rspec命令可能需要40秒才能开始,然后花费6秒钟来运行测试(这种情况下适当的时间)。 Rails服务器可能需要40秒才能启动。

It wasn't always this way but somewhere along the way of updating gems, installing newer stuff, getting Aptana IDE, it hit the fan.

它并不总是这样,但在更新宝石,安装更新的东西,获得Aptana IDE的方式,它击中了粉丝。

Any ideas how to get the wrench out the engine? Thanks.

任何想法如何让扳手脱离发动机?谢谢。

3 个解决方案

#1


0  

I am using Ruby 1.9.3p392, Rails 3.2.13. The project connects to a mysql database.

我使用的是Ruby 1.9.3p392,Rails 3.2.13。该项目连接到mysql数据库。

  • tried it on Window 7 - server takes 10s to startup, rendering a login page takes over 1 minute.
  • 在Window 7上尝试过它 - 服务器需要10秒才能启动,渲染登录页面需要1分钟。
  • tried it on ubuntu 12.10 virtual machine on virtualbox - twice as worst
  • 在虚拟机上的ubuntu 12.10虚拟机上尝试过它 - 是最差的两倍
  • tried it on ubuntu 12.10 virtual machine on VMWare player - much better, almost on par with Windows 7.
  • 在VMWare播放器上尝试使用ubuntu 12.10虚拟机 - 更好,几乎与Windows 7相同。

So I bite the bullet and setup a dual boot linux-mint system, and the problems go away. So the problem lies with some low level system api that even a virtual machine is dependent on.

所以我咬紧牙关并设置双启动linux-mint系统,问题就消失了。所以问题在于一些甚至虚拟机依赖的低级系统api。

There are other problems with using Windows as well, for example many gems are not compiled for windows (like therubyracer and imagemagic), so you need to jump through the loop to get them to work.

使用Windows也存在其他问题,例如许多gems不是为windows编译的(如therubyracer和imagemagic),所以你需要跳过循环才能使它们工作。

So in conclusion, forget about Windows for RoR development. But seriously, if RoR is made more Windows friendly, I am certain it will be quite a lot more popular. I almost gave up in the process, and it remain a real pain for me having to switch between Windows and Linux every so often.

总而言之,忘记Windows进行RoR开发。但严重的是,如果RoR更适合Windows,我相信它会更受欢迎。我几乎放弃了这个过程,对于我经常在Windows和Linux之间切换而言,这仍然是一个真正的痛苦。

#2


1  

I'm not an expert on Win7, but I would suggest checking your system memory and cpu usage. See if there is a bottle neck.

我不是Win7的专家,但我建议检查你的系统内存和CPU使用情况。看看是否有瓶颈。

#3


0  

Also, at the very least, make sure you're running the latest version of Bundler. Up until fairly recently it's version was 1.0.x. It recently went to 1.1 and is now at 1.1.3 with the major change being how long it too to walk the dependency tree among gems.

此外,至少,请确保您运行的是最新版本的Bundler。直到最近它的版本是1.0.x.它最近达到1.1,现在是1.1.3,主要的变化是在宝石中走依赖树的时间。

Also, I too use Windows 7 for Ruby in some situations. I also found that installing "thin" as your Rails web server ( C:\ gem install thin ) will perform much faster than the default WEBrick server.

另外,在某些情况下我也使用Windows 7 for Ruby。我还发现安装“瘦”作为你的Rails Web服务器(C:\ gem install thin)将比默认的WEBrick服务器快得多。

If you these two things, I think you'll notice a performance increase.

如果你这两件事,我想你会注意到性能提升。

As far as your tests go, if you're using RSpec..that's just the nature of the beast.

就你的测试而言,如果你正在使用RSpec ......这只是野兽的本质。

#1


0  

I am using Ruby 1.9.3p392, Rails 3.2.13. The project connects to a mysql database.

我使用的是Ruby 1.9.3p392,Rails 3.2.13。该项目连接到mysql数据库。

  • tried it on Window 7 - server takes 10s to startup, rendering a login page takes over 1 minute.
  • 在Window 7上尝试过它 - 服务器需要10秒才能启动,渲染登录页面需要1分钟。
  • tried it on ubuntu 12.10 virtual machine on virtualbox - twice as worst
  • 在虚拟机上的ubuntu 12.10虚拟机上尝试过它 - 是最差的两倍
  • tried it on ubuntu 12.10 virtual machine on VMWare player - much better, almost on par with Windows 7.
  • 在VMWare播放器上尝试使用ubuntu 12.10虚拟机 - 更好,几乎与Windows 7相同。

So I bite the bullet and setup a dual boot linux-mint system, and the problems go away. So the problem lies with some low level system api that even a virtual machine is dependent on.

所以我咬紧牙关并设置双启动linux-mint系统,问题就消失了。所以问题在于一些甚至虚拟机依赖的低级系统api。

There are other problems with using Windows as well, for example many gems are not compiled for windows (like therubyracer and imagemagic), so you need to jump through the loop to get them to work.

使用Windows也存在其他问题,例如许多gems不是为windows编译的(如therubyracer和imagemagic),所以你需要跳过循环才能使它们工作。

So in conclusion, forget about Windows for RoR development. But seriously, if RoR is made more Windows friendly, I am certain it will be quite a lot more popular. I almost gave up in the process, and it remain a real pain for me having to switch between Windows and Linux every so often.

总而言之,忘记Windows进行RoR开发。但严重的是,如果RoR更适合Windows,我相信它会更受欢迎。我几乎放弃了这个过程,对于我经常在Windows和Linux之间切换而言,这仍然是一个真正的痛苦。

#2


1  

I'm not an expert on Win7, but I would suggest checking your system memory and cpu usage. See if there is a bottle neck.

我不是Win7的专家,但我建议检查你的系统内存和CPU使用情况。看看是否有瓶颈。

#3


0  

Also, at the very least, make sure you're running the latest version of Bundler. Up until fairly recently it's version was 1.0.x. It recently went to 1.1 and is now at 1.1.3 with the major change being how long it too to walk the dependency tree among gems.

此外,至少,请确保您运行的是最新版本的Bundler。直到最近它的版本是1.0.x.它最近达到1.1,现在是1.1.3,主要的变化是在宝石中走依赖树的时间。

Also, I too use Windows 7 for Ruby in some situations. I also found that installing "thin" as your Rails web server ( C:\ gem install thin ) will perform much faster than the default WEBrick server.

另外,在某些情况下我也使用Windows 7 for Ruby。我还发现安装“瘦”作为你的Rails Web服务器(C:\ gem install thin)将比默认的WEBrick服务器快得多。

If you these two things, I think you'll notice a performance increase.

如果你这两件事,我想你会注意到性能提升。

As far as your tests go, if you're using RSpec..that's just the nature of the beast.

就你的测试而言,如果你正在使用RSpec ......这只是野兽的本质。