Skip to content

Instantly share code, notes, and snippets.

@siman-man
Created April 25, 2014 11:37
Show Gist options
  • Save siman-man/11286530 to your computer and use it in GitHub Desktop.
Save siman-man/11286530 to your computer and use it in GitHub Desktop.
require 'benchmark'
Benchmark.bm do |x|
num = 100000000
x.report do
a = 0
num.times{ a += 1 }
end
x.report do
a = 0
num.times{ a = a + 1 }
end
x.report do
a = 0
num.times{ a = a.succ }
end
x.report do
a = 0
num.times{ a = a.next }
end
end
@siman-man
Copy link
Author

next遅かった

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