2

I've tried all three (granted the Ubuntu versions were via VirtualBox with XP as a host, but I gave the images all the available RAM my system has). Loading the rails environment is taking 30-60 seconds. rails console, rake test:units - anything that requires rails to load up. And not just on the first go - every time. I've even used autotest to see if it helps with execution time for unit tests, but it doesn't. Any time I change one test, it still takes 30 seconds to load them, and then about 4 seconds to execute.
Has anyone else come across this issue? Has anyone figured out any way to fix this?

bergyman
  • 133
  • 3
  • "I gave the images all the available RAM my system has," be careful: giving too much RAM to a virtual machine is a common mistake that will kill performance by depriving the host OS. Rails runs fine in Unix environments with very little RAM, as evidenced by the abundant availability of perfectly functional Rails-optimized hosted virtual servers with only 256MB of RAM. You probably have no reason to cut it quite that thin, but giving your VM more than a gig of RAM is highly unlikely to yield a significant performance advantage in a development/test environment. – Skyhawk Apr 13 '11 at 23:17

2 Answers2

1

checkout http://github.com/rdp/faster_require or alternatively run it in a virtualbox running linux.

rogerdpack
  • 577
  • 2
  • 8
  • 23
  • The original poster has tried running it in a virtual Linux machine, and it's made no difference. – WheresAlice Jun 11 '10 at 18:05
  • Yeah but that library looks like it might help. Thankfully I'm no longer stuck in the awful world of developing ruby on Windows, so I can' try it out. Thanks for the answer though! – bergyman Jun 12 '10 at 14:21
1

The time taken to load can be affected by the number of dependencies which must be loaded. Perhaps your rails application depends on a lot of gems, which can slow down load time considerably.

The solutions generally used to mitigate this problem are:

  • for production instances (which handle web traffic), many web servers (eg. unicorn) can eager load and fork using copy on write so that loading is only done once (additional instances will reference the same memory until they start to alter the contents). This is often done so that restarting one of the processes (possibly due to a crash) does not use excessive amounts of additional server resources
  • for testing purposes, see Fast Rails Commands, which suggests the use of zeus, spring or spork gems. This keeps a background copy of a ruby/rails process running to handle your rails tests.
ronalchn
  • 213
  • 3
  • 9