Created
May 13, 2014 14:12
-
-
Save kouba-c/de49f43915b2ca6d5ae8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
#ruby2.1.0 | |
#x64 | |
fixnum_max = 4611686018427387903 | |
bignum_min = fixnum_max + 1 | |
#Fixnum | |
Benchmark.bm do |b| | |
b.report do | |
(0..fixnum_max).step(100000000000) {|n|} | |
end | |
end | |
#Bignum | |
Benchmark.bm do |b| | |
b.report do | |
(bignum_min..(bignum_min + fixnum_max)).step(100000000000) {|n|} | |
end | |
end | |
# user system total real | |
# 2.100000 0.010000 2.110000 ( 2.201473) | |
# user system total real | |
# 11.400000 0.060000 11.460000 ( 12.068350) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment