Live data from Hacker News

Speeding up Rails startup time

rhnh.net

31–33 of 33 posts

Re: Speeding up Rails startup time

#31
post #17

I've always thought it would be nice if you could cause Ruby to dump its heap and symbol table to a file, which could then be loaded by other instances of Ruby. So, for example, you could run Ruby, load all of the Rails files, and then save everything, so the next time you want to run Rails, you just have to load one file instead of hitting the file system 2000 times. You could probably also do this by running a Rail…

This reminds me of an old joke:

One day in the early days of computing, General Electric had a problem with their computer. All of their engineers took a look at the problem. Although each was wise, they were unable to understand the complexity of the machinery and repair the error. A call was made to the retired engineer who had helped in the original set up of the machine.

The retired engineer walked around the machine for a few minutes, just looking it over, not touching anything. After a few minutes, He took out a piece of chalk, walked over and placed a large X on one particular part of the machine. He then said' "Tap it here with a hammer, just once."

After the one tap, the computer roared back to life and began working!

A few days later, GE received an invoice from the retired engineer for $10,000! This was a lot of money in those days, so they returned it to the engineer and asked that he itemize his invoice.

A few days later, they received an itemized bill which read:

Chalk for one X mark - $1.00

Knowing where to place the X - $9,999.00

Re: Speeding up Rails startup time

#32
post #10

Does this problem exist in jruby and rubinius as well?

jruby big yes and they're aware of it and this fix. rubinius small yes, possibly a maybe (haven't investigated properly).

Rubinius uses the exact same technique as is detailed here, namely backing an Array with a Hash (LookupTable in the Rubinius case). We added this a few years ago to speed up require.

Re: Speeding up Rails startup time

#33
post #20

Earlier quoted context omitted.

I haven't tested this myself, but I can guess that they will load slower in development. In development asset requests go through the asset pipeline now instead of being directly served up through the HTTP server.

is there a reason to dump your images into the assets vs public folder then?

Not really for application specific images. However, vendor, lib, and engine images will be copied into public in production. Keeps you from manually having to keep somebody elses asset dependencies updated in your app.
Post reply on HN