Skip to content

Instantly share code, notes, and snippets.

@pjb3
Created October 16, 2012 00:51
Show Gist options
  • Save pjb3/3896661 to your computer and use it in GitHub Desktop.
Save pjb3/3896661 to your computer and use it in GitHub Desktop.
Why is ruby 1.9.3 so slow to start?
$ time perl -e 'print "foo\n"'
foo
real 0m0.009s
user 0m0.004s
sys 0m0.004s
$ time ruby -e 'puts "foo"'
foo
real 0m0.184s
user 0m0.082s
sys 0m0.101s
$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
@ootoovak
Copy link

I get the following with the same version of Ruby.

bash-3.2$ time perl -e 'print "foo\n"'
foo

real 0m0.006s
user 0m0.003s
sys 0m0.002s

bash-3.2$ time ruby -e 'puts "foo"'
foo

real 0m0.016s
user 0m0.012s
sys 0m0.003s

bash-3.2$ time python -c 'print "foo"'
foo

real 0m0.026s
user 0m0.018s
sys 0m0.007s

@pjb3
Copy link
Author

pjb3 commented Oct 16, 2012

Hmm..appears to be related to rvm:

$ rvm system
$ time ruby -e ''

real    0m0.026s
user    0m0.003s
sys 0m0.015s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment