Reputation: 27275
I've got a ruby script which takes about 30 seconds to startup. It takes that much because it tries to load all libraries and stuff.
When I do ruby.exe -v
it's instant.
I don't want to touch the original ruby script, which is not written by me.
What are the tricks to speed this process up?
I need to do this under Windows or Cygwin.
UPDATE :
Upvotes: 4
Views: 1606
Reputation: 3941
I presume the script uses rubygems? (It'll say require "rubygems" if so)
You could try installing minigems (gem install minigems) and then use minigems instead of rubygems - should speed things up a little.
Upvotes: 1
Reputation: 5166
Sorry, but there is no way to compile a ruby script. What sort of stuff is this script loading/doing?
You're right, 30 seconds is quite long. Is this script making calls out to the web or databases that are very expensive? It's hard to believe that libraries would take so long to load
... I just noticed the comments and saw that you got it down to 1-4 seconds...that's very good, especially when coming down from 30. Other comments are right, please post the requires at the top of the script
Upvotes: 0