This is exciting, the load time is one of the things that is most painful for me when working with Rails. It's really great when you can just add gems and get things working quickly but the load time tends to shoot through the roof... Spork etc help but you still end up spending a lot of time waiting.
Rails tests that takes too long are also painful too. If you try to speed them up, you might run into the problem of having to restart from scratch when you write stuff that need restarting to take effects.
Ruby 2.0 patch that could make Rails startup 2.2x faster
11–20 of 22 posts
Re: Ruby 2.0 patch that could make Rails startup 2.2x faster
#12Re: Ruby 2.0 patch that could make Rails startup 2.2x faster
#13The falcon patches for 1.9.3 together with GC tuning boosted our rails loading time by over 400% (Thanks to the answer on http://stackoverflow.com/questions/12892937/improve-rails-lo... ). It's easy to see how required gems add up to the loading time, so I hope to see some more improvements. This affects a lot of things: going into the console, running the server, running tests, running migrations, rake tasks etc...…
Re: Ruby 2.0 patch that could make Rails startup 2.2x faster
#14For a really fast Rails environment I highly recommend Zeus https://github.com/burke/zeus which is built in Go. It does a great job of reloading only the dependencies that have changed.
Re: Ruby 2.0 patch that could make Rails startup 2.2x faster
#15Re: Ruby 2.0 patch that could make Rails startup 2.2x faster
#16For a really fast Rails environment I highly recommend Zeus https://github.com/burke/zeus which is built in Go. It does a great job of reloading only the dependencies that have changed.
Re: Ruby 2.0 patch that could make Rails startup 2.2x faster
#17The falcon patches for 1.9.3 together with GC tuning boosted our rails loading time by over 400% (Thanks to the answer on http://stackoverflow.com/questions/12892937/improve-rails-lo... ). It's easy to see how required gems add up to the loading time, so I hope to see some more improvements. This affects a lot of things: going into the console, running the server, running tests, running migrations, rake tasks etc...…
Yeah, I immediately thought of the falcon patches too when I saw this. Does anyone know how they compare to these patches?
Re: Ruby 2.0 patch that could make Rails startup 2.2x faster
#18The falcon patches for 1.9.3 together with GC tuning boosted our rails loading time by over 400% (Thanks to the answer on http://stackoverflow.com/questions/12892937/improve-rails-lo... ). It's easy to see how required gems add up to the loading time, so I hope to see some more improvements. This affects a lot of things: going into the console, running the server, running tests, running migrations, rake tasks etc...…
Yeah, I immediately thought of the falcon patches too when I saw this. Does anyone know how they compare to these patches?
The main difference between the patches is how we maintain the needed invariants, as both $LOAD_PATH and $LOADED_FEATURES are visible to Ruby code and actually mutable from Ruby code. The falcon patches put singleton methods on each of those arrays, wrapping the methods that mutate arrays in order to make them maintain the invariant. This is a very general approach that could implement any desired behavior, but it is relatively complex in the number of cases it has to explicitly handle.
My patches instead take advantage of a feature of the Array implementation to keep a snapshot of each of $LOAD_PATH and $LOADED_FEATURES, and on each 'require' call detect whether they've been mutated. If they have, we rebuild our invariants. This has an advantage in simplicity -- the Array implementation already must track when an Array is mutated, and we just piggyback on that. It can cost more time, but never much more than the status quo (where we must effectively rebuild all the state on every 'require' call), and in normal usage people rarely mutate $LOADED_FEATURES at all and mutate $LOAD_PATH in only one or a handful of bursts, rather than alternating mutation, require, mutation, require many times. So in practice it should be almost as fast as if we never had to rebuild.
NB that funny_falcon himself, aka Yura Sokolov, is participating in the bug thread, so you can read his thoughts there.
Re: Ruby 2.0 patch that could make Rails startup 2.2x faster
#19Here's a script to install these patches using rvm: https://gist.github.com/3993269
Re: Ruby 2.0 patch that could make Rails startup 2.2x faster
#20For a really fast Rails environment I highly recommend Zeus https://github.com/burke/zeus which is built in Go. It does a great job of reloading only the dependencies that have changed.
Agreed, although improving load times all across the board is surprisingly helpful. It can make restarting your app in production after a deploy faster, for instance. If anything it just makes you happier in dev if you're running some Ruby command outside of Spork or Zeus.
If in reference to just improving speeds all across the board - recovery after deploy is the #1 priority for me. Rolling restarts feel like unnecessary complexity in deploys.