Skip to content

Instantly share code, notes, and snippets.

@voidlock voidlock/snippet.rb
Created Apr 7, 2010

Embed
What would you like to do?
require "geoip_city"
require "geoip"
require "benchmark"
db = '/usr/local/share/GeoIP/GeoIPCity.dat'
ip = '24.24.24.24'
geoip_c = GeoIP::City.new(db)
geoip_city = GeoIPCity::Database.new(db)
ITER = 100_000
Benchmark.bmbm do |x|
x.report("geoip-c") { ITER.times { geoip_c.look_up(ip) } }
x.report("geoip_city") { ITER.times { geoip_city.look_up(ip) } }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.