Skip to content

Instantly share code, notes, and snippets.

@wanabe
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save wanabe/59de868df5672cced0b3 to your computer and use it in GitHub Desktop.

Select an option

Save wanabe/59de868df5672cced0b3 to your computer and use it in GitHub Desktop.
$ cat a.rb
def calc
t = Time.now
1000000.times do yield end
Time.now - t
end
r=1/2r
f=0.5
p calc{Math.sqrt(10.0)}, calc{Math.sqrt(10)}, calc{10**f}, calc{10**r}
$ ruby --disable-gems -v a.rb
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
0.205262761
0.919693189
0.37334026
1.618261332
$ rbenv local 2.1.2
$ ruby --disable-gems -v a.rb
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
0.201362993
0.862203873
0.369552134
1.734462281
$ rbenv local 2.1.5-i386-mingw32
$ ruby --disable-gems -v a.rb
ruby 2.1.5p273 (2014-11-13 revision 48405) [i386-mingw32]
0.313432
1.161717
0.769248
2.816882
$ ./ruby --disable-gems -v a.rb
ruby 2.3.0dev (2015-03-21 trunk 50042) [x86_64-linux]
0.205198079
0.206761771
0.350608919
1.656558415
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment