diff options
| author | bluemonk <ceresa@gmail.com> | 2010-08-13 11:05:38 +0200 |
|---|---|---|
| committer | bluemonk <ceresa@gmail.com> | 2010-08-13 11:05:38 +0200 |
| commit | 281118659d51aba324730051c61103085dc92048 (patch) | |
| tree | f666b4288ca70db0a8869c7639148a1d7d8ac7df | |
| parent | f990bb7457d6f5500a3b3ecbc846fe13369661be (diff) | |
| download | ipaddress-281118659d51aba324730051c61103085dc92048.tar.gz | |
Added IPv4#to_s benchmark test
| -rw-r--r-- | utils/benchmark_to_s.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/utils/benchmark_to_s.rb b/utils/benchmark_to_s.rb new file mode 100644 index 0000000..dafd833 --- /dev/null +++ b/utils/benchmark_to_s.rb @@ -0,0 +1,21 @@ +$:.unshift(File.dirname(__FILE__) + '/../lib') + +require 'benchmark' +require 'ipaddress' +require 'ipaddr' + +n = 200_000 + + Benchmark.bm do|b| + b.report("ipaddr ") do + n.times { IPAddr.new("192.168.10.100").to_s } + end + + b.report("ipaddress parse ") do + n.times { IPAddress.parse("192.168.10.100").to_s } + end + + b.report("ipaddress ipv4 ") do + n.times { IPAddress::IPv4.new("192.168.10.100").to_s } + end + end |
