It takes almost ten seconds to start a Rails test on my Windows XP box. The test may report that it took it a fraction of a second to run, but it actually takes about ten seconds for it to start. The Rails Console and Mongrel have the same problem, but I can deal with that. However, with unit tests, it’s not acceptable because rapid feedback from tests is the key to rapid development.
I’ve had JUnit tests using Spring and Hibernate that start faster than this. And in Java, incremental compilers (for example, the one that comes with Eclipse) tell me immediately when I’ve stuffed up syntax. With interpreted Ruby on Rails, I have to wait ten seconds just to be told that I’ve made a typo.
To experience the problem, all I have to do is create a new Rails project, create a single model, and then run the test for that model. It takes ten seconds to start the test, give or take a second or so. Trying JRuby is not an option at this stage because at the end of the day I need to use ferret on my project, which requires native C extensions.
I started playing around with Ubuntu on VMWare on Windows and discovered that Rails starts faster under this setup than on Windows directly. I don’t really know why, but my best guess is that the Windows filesystem isn’t very good for serving up all of the text files that Ruby processes when it bootstraps the Rails environment. I’m guessing that VMWare, on the other hand, pretty much takes one big Windows file and lets Ubuntu treats it as a single Unix filesystem.
Those people who have raised concerns about this on the web are met with deafening silence or are told to get a Mac. I ended up getting a Mac and everything runs fine on that. However, I still need to test with IE 6 and 7 so have to have a couple of instances of Windows XP running anyway.
I want to be wrong. I’ll issue a public retraction if I am. But until proven otherwise, my message for you is this: if you want to do Rails development and you’re running Windows, be prepared to buy a Mac or set up a Linux environment.
For those who care, I’m using Ruby 1.8.6 and Rails 1.2.3. I’ve got a 1.7GHz Pentium M with 1GB RAM and 10GB of free drive space. I’ve got colleagues with 2GB of RAM that have the same problem. If I look at the task manager whilst starting a test, it seems to be mainly CPU cycles that Ruby is taking, not RAM.
Stop Press: I’ve done the same thing with JRuby and have had the same problem.