Created
July 7, 2009 00:16
-
-
Save bloopletech/141785 to your computer and use it in GitHub Desktop.
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
require 'benchmark' | |
def bench_small | |
puts Benchmark.measure { | |
1.upto(10_000) { |n| n.humanize } | |
} | |
end | |
def bench_large | |
puts Benchmark.measure { | |
1_000_000_000_000_000_000_000_000_000_000_000_000_000_000.upto(1_000_000_000_000_000_000_000_000_000_000_000_000_010_000) { |n| n.humanize } | |
} | |
end | |
require 'humanize/lib/humanize' | |
puts "Times for Radar's small" | |
10.times { bench_small } | |
puts "Times for Radar's large" | |
10.times { bench_large } | |
#Numeric.send(:remove_method, :humanize) | |
require 'humanize_numbers' | |
puts "Times for mine small" | |
10.times { bench_small } | |
puts "Times for mine large" | |
10.times { bench_large } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment