Hacker News new | ask | show | jobs
by cduan 5496 days ago
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 Rails instance as a service, and then every time you want to run Rails, you tell the service to fork, and use the forked thread. I think this is how Passenger works actually?

3 comments

I've always thought it would be nice if you could cause Ruby to dump its heap and symbol table to a file...

Another full circle back to Lisp. Dumping a Lisp image file is much like you describe. (Just sayin'.)

You could probably also do this by running a Rails instance as a service, and then every time you want to run Rails, you tell the service to fork, and use the forked thread.

FWIW, this is how Spork works, a tool people have been using a lot more recently in order to have fast(er) tests on Rails 3. Spork boots up an environment then waits for RSpec (or whatever) to hit it over DRb and then it forks off for that run.

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