Rails Initializes Extremely Slow on Ruby 1.9.1

Experiencing Poor Performance Rails

Please include the version of Ruby you are using for your tests.

Try running Rails 3 on Ruby 1.9.2-head and see if you notice a difference. You can use something like RVM to try multiple versions of Ruby very easily.

As noted in this SO question, 1.9.1 seems to have some performance issues. If you are using Ruby Enterprise Edition with Rails 3, that may be causing some performance issues as well. If you use plugins that are not Ruby 1.9 compatible, make sure you are using REE >= 1.8.7-2010.02 as noted on the Edge Rails Guides.

I believe Rails 3 development is being targeted at 1.9.2 and backported to run on earlier versions.

Why is ruby so much slower on windows?

I would guess there are a few possible options, and they probably all add up:

  1. Ruby being mainly developed on Linux, it ends up mechanically optimised for it. The code is regularly tested for Windows and everything works, but the result is still that developer will spend more time optimising for Linux than Windows.
  2. To my experience, recent versions of gcc (4.3 and greater) produce code more efficient than recent versions of Visual Studio (at least 2005). My tests included in both case spending about a day finding the best options for code optimisation.
  3. Related to point 1, if you compile the same project using gcc for Windows or Linux, I usually observe a drop of performances of about 20% on Windows compared to Linux. Here again, I suppose this is because Linux (or Unices in general) is a primary target for gcc, windows is a port. Less time is spent optimising for Windows than Linux.

In the end, if one would want to optimise Ruby for Windows, a significant amount of time (and money, as far as I know, profilers on Windows don't come for free) will have to be spent using a profiler and optimising bottlenecks. And everything will have to be tested on Linux to make sure there is no loss of performance.

Of course, all than should be tested again with their new interpreter
YARV.

Disabling Ruby 1.9.x's YARV compiler

YARV is a pure Ruby compiler. If you disable it, there's nothing left.

More precisely: YARV is a multi-phase implementation, where each of the phases is single-mode. It consists of a Ruby-to-YARV compiler and a YARV interpreter. If you remove the compiler, the only thing you are left with is the YARV bytecode interpreter. Unless you want to start writing your app in YARV bytecode, that interpreter is not going to be of much use to you.

This is in contrast to mixed-mode implementations such as JRuby and IronRuby which implement multiple execution modes (in particular, both a compiler and an interpreter) within a single phase. If you turn off the compiler in JRuby or IronRuby, you are still left with a usable execution engine, because they both also contain an interpreter. In fact, JRuby actually started out as a pure interpreter and added the compiler later and IronRuby started out as pure compiler and they added an interpreter exactly because of the same problem that you are seeing: compiling unit tests is simply a waste of time.

The only interpreted implementation of Ruby 1.9 right now is JRuby. Of course, there you have the whole JVM overhead to deal with. The best thing you can do is try how fast you can get JRuby to start up (use the nightly 1.6.0.dev builds from http://CI.JRuby.Org/snapshots/ since both 1.9 support and startup time are heavily worked on right this very moment) using either some very fast starting desktop-oriented JVM like IBM J9 or try JRuby's Nailgun support, which keeps a JVM running in the background.

You could also try to get rid of RubyGems, which generally eats up quite a lot of startup time, especially on YARV. (Use the --disable-gem commandline option to truly get rid of it.)

phusion passenger and ruby 1.9.1 is it working already?

Yes it's officially supported since some 2.2.x release for which I can't remember the exact number. It was written in the release notes. The past few 2.2 releases have only continued to add 1.9-related bug fixes. The upcoming 3.0 release will officially support 1.9.2 as well (though this doesn't imply that 1.9.2 doesn't already work).

You can't run two Ruby versions simultaneously yet but it's on the todo list.

Is Cucumber broken under Ruby 1.9.1 and Rails 2.3.2?

Is it ruby 1.9 says that it works just fine.

http://isitruby19.com/cucumber

warning: already initialized constant after installing tlsmail gem?

At least, it seems, that you're not alone. I'm not terribly familiar with that gem, but it looks like this might be a fix for you: http://blog.snootymonkey.com/post/892799550/already-initialized-constant-warnings

It's possible that ActionMailer (or some other mailer code/plugin) is included by default as part of Rails 3. Don't quote me on that, but that's my unsubstantiated hunch as far as where the conflicting names might be coming from.



Related Topics



Leave a reply



Submit