Skip to content

Instantly share code, notes, and snippets.

@NZKoz
Created January 28, 2014 20:16
Show Gist options
  • Save NZKoz/8675428 to your computer and use it in GitHub Desktop.
Save NZKoz/8675428 to your computer and use it in GitHub Desktop.
Koz-Prostyle-2:store michaelkoziarski$ time /usr/bin/ruby -e ''
real 0m0.117s
user 0m0.031s
sys 0m0.056s
Koz-Prostyle-2:store michaelkoziarski$ time ~/.rbenv/shims/ruby -e ''
real 0m0.096s
user 0m0.057s
sys 0m0.038s
@sdball
Copy link

sdball commented Jan 28, 2014

$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin13.0.2]
$ time ruby -e ''
ruby -e ''  0.01s user 0.00s system 94% cpu 0.011 total

$ chruby 2.0
$ ruby -v
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.0.2]
$ time ruby -e ''
ruby -e ''  0.02s user 0.00s system 93% cpu 0.027 total

$ chruby 2.1
$ ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]
$ time ruby -e ''
ruby -e ''  0.02s user 0.01s system 96% cpu 0.031 total

¯\_(ツ)_/¯

@postmodern
Copy link

With chruby and ruby 2.0.0-p353:

$ /usr/bin/ruby -v
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]
$ time /usr/bin/ruby -e ''
real    0m0.350s
user    0m0.115s
sys 0m0.043s
$ chruby ruby-2.0.0-p353
$ which ruby
~/.rubies/ruby-2.0.0-p353/bin/ruby
$ time ruby -e ''
real    0m0.031s
user    0m0.029s
sys 0m0.002s

If you do not want any additional overhead when invoking ruby, I highly recommend trying chruby.

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