Created
January 22, 2020 13:49
-
-
Save rhiroyuki/8a3d4de351565db30a595a8d4854d366 to your computer and use it in GitHub Desktop.
Benchmark ruby
This file contains hidden or 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
def old_method | |
100000.times do | |
sleep(1) | |
end | |
end | |
def new_method | |
100000.times do | |
sleep(2) | |
end | |
end | |
Benchmark.bm do |x| | |
x.report("Old:") { old_method } | |
x.report("New:") { new_method } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment