For me, no matter what rake task has been executed, it's at least 20 seconds. The time is too long.
My OS: windows xp, rails: 2.3.8, ruby: 1.8.7
UPDATE
Are there any ways of speeding up rake? Someone said upgrade to ruby 1.9, but I don't know does it work well with rails 2.3.8? (I see in the rails' website, they recommend ruby 1.8.7)
http://en.wikibooks.org/wiki/Ruby_Programming/Installing_Ruby#Windows_is_slow
Related
I am having an big old ruby on rails application
ruby version - 1.8.7 (2011-06-30 patchlevel 352)
rails version - 2.3.16
currently there is no plan in migrating rails version
As far as i know the performance of ruby 1.9.x is 2 times faster than 1.8.7
Questions:
1) I would like to know whether rails 2.3.16 is fully compatible with ruby 1.9.3-p385 ?
2) I am looking for basic generic steps in only migrating ruby 1.8.7 to ruby 1.9.3 without upgrading rails 2.3.x to rails 3.xx
3) And i would like to know the migration complexity level and issues?
Note:
I am looking for answers, suggestions, comments and reviews from those who really involved in ruby app migration from 1.8.7 to 1.9.3 by sticking with rails 2.3.x
I found this migration guide, maybe it'll give you answers. http://developer.uservoice.com/blog/2012/03/04/how-to-upgrade-a-rails-2-3-app-to-ruby-1-9-3/
From what I read, it can be quite a pain in the ass, since rails 2.3 does not support ruby 1.9.
If you can do it, I'd suggest migrating your rails anyway, at least 3.0 (before the asset pipeline) : it will still be a pain in the ass (as with any big migrations), but there are tools like rails_upgrade meant to facilitate this process.
Update a Rails application to the latest Ruby version with Rbenv.
I'm using RVM to manage my environments for a few Rails projects. One of them is running Rails 3 on ruby 1.9.2, and one is running Rails 2.3 on ruby 1.8.7. The 1.8.7 environment is very slow to start any rails-based tasks (console, server, tests) - I mean 45s - 2 minutes depending on what's happening. The 1.9.2 environment is as snappy as can be.
I've tried playing with the patch level of the 1.8.7 environment, but that only helped a bit, and only for certain tasks (console and server). Tests still take forever to start, even when I'm running them individually with a ruby command.
Does anyone have an idea of what could be happening here?
Try to use spork gem which preload environment to your rails application. But it only depends on rspec tasks, I guess.
Another way: try to use ruby enterprise edition. http://www.rubyenterpriseedition.com/
I'm using RVM for managing environment, installed Ruby 1.9.2.p136 (i think its latest release.) and Rails 3, created gemsets and run bundler. everything working good so far
but;
Rails initalizes extremely slow when running commands, i.e. generate, destroy, rake etc.
Takes about 30-45 seconds to complete command. This will never happens if use Ruby Enterprise Edition or Ruby 1.8.7
Why this happens. Any thoughts?
Running on Ubuntu 10.10, RVM, Ruby 1.9.2, Rails 3
Thanks.
There is a thread about this on Rails-Core - http://groups.google.com/group/rubyonrails-core/browse_thread/thread/88519ef5a53088a1/c01ba447c6dc0de7?lnk=raot
To quote Yehuda Katz
"There are things that the C require code does in 1.9 that slow things down.
One such example is re-checking $LOAD_PATH to make sure it is all expanded
on every require. This is something that should be addressed by ruby-core.
I'll open a ticket on redmine if there isn't one already."
I am also experiencing this problem and a $LOAD_PATH issue seems like a potential cause. Lets hope it gets fixed soon.
Try to strace (on unix), dtruss (on mac) your command (might need to "sudo" though). It'll show you where the process is spending its time. Notice where it pauses. This is definitely not normal.
Looking to build a Rails 3 stack and trying to sort out Ruby versions.
I'm very interested in the concept of JVM, but not 100% sure if it even relates to Rails 3; meaning why not just do a deploy just for JVM if needed.
Then there's heroku saying there's a bug in Ruby 1.9.1, but they don't say what the bug is, if it's addressed by Ruby 1.9.2 -- or what will happen as a result of running Rails 3 on Ruby 1.8.6.
UPDATE: Found the bug heroku is indirectly linking to: "Note that Ruby 1.8.7 p248 and p249 have marshaling bugs that crash Rails 3.0. Ruby Enterprise Edition have these fixed since release 1.8.7-2010.02 though. On the 1.9 front, Ruby 1.9.1 is not usable because it outright segfaults on Rails 3.0, so if you want to use Rails 3 with 1.9.x jump on 1.9.2 for smooth sailing."
Anyone have info/link on the subject?
Thanks!
If you're running on windows, my personal recommendation is go with JRuby. MRI (both 1.9.x and 1.8.x) has mountains of problems on windows, whether deploying to XP, Vista, or Windows 7. I don't develop on Windows often, but I do teach Rails classes, and that's my recommendation to Windows students now. Haven't had many issues with JRuby at all, aside from needing to use a different database driver (the jdbc gem versions). RVM doesn't work on windows, but you can use pik (https://github.com/vertiginous/pik) to achieve many of the same goals.
My advice is that if you're starting a new Rails 3 project you should definitely think about kicking it off using Ruby 1.9.2. Heroku supports multiple stacks with the default now being Bamboo (the one that supports 1.9.2 as well as REE). If you're worried about gem compatibility or something else then you can hedge your bets and use RVM and/or multiruby to run your test suite across multiple versions of ruby so you can deploy to either run time.
Personally I'm running a Rails 2 app on REE and a Rails 3 app on 1.9.2 and haven't had any problems.
If you're not deploying on Heroku and are setting up your own server then I would manage your Ruby versions using RVM on your production server so you can easily switch between versions if anything doesn't work.
In summary:
You can run Rails 2 and 3 apps on both REE and Ruby 1.9.2.
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.
Any ideas why ruby 1.9 would be 3 - 4 times slower? I can't figure it out for the life of me.
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).
If you are using RVM, type the following:
rvm install 1.9.2-head
rvm use 1.9.2-head
Edit: 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 :)
It's probably because ruby 1.9 uses gem_prelude (which gives you a large load path) instead of normal rubygems. Checkout the length of $: -- that gets searched once for each require, causing extra time
If you want it the old way, (upgrade to the latest version of rubygems and) run ruby --disable-gems
If you are on windows, take a look into my faster_require gem.
http://github.com/rdp/faster_require
Though I suppose, now that you mention it, it might help in 1.9 Linux. Maybe.
GL!
-rp