Created
July 15, 2015 00:49
-
-
Save yoppi/d6bd1402968fddc1bc69 to your computer and use it in GitHub Desktop.
geoip and geoip-c benchmark
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 'geoip' | |
require 'benchmark' | |
n = 1000000 | |
# geoip-c C extended library | |
Benchmark.bm do |x| | |
geoip = GeoIP::City.new("/usr/share/GeoIP/GeoLiteCity.dat", :memory, false) | |
x.report { n.times { geoip.look_up("144.206.125.148") } } | |
# user system total real | |
# 10.480000 0.070000 10.550000 ( 10.604084) | |
end | |
# geoip pure Ruby implement | |
Benchmark.bm do |x| | |
geoip = GeoIP.new("/usr/share/GeoIP/GeoLiteCity.dat") | |
x.report { n.times { geoip.city("144.206.125.148") } } | |
# user system total real | |
# 104.030000 25.760000 129.790000 (132.106001) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment