I did some benchmarking of my own.  This one tests out the performance of a single lookup.  I only ran this on solutions which work with IpToCountry.csv out of the box (aka do no prep work).

This benchmark ran each solution 1000 times with random IPs (invoking a new ruby instance on each run).

-bash-2.05b$ ruby bm.rb
sorted by real time
[["steved.rb", 10.5210349559784],
 ["adam.rb", 10.817939043045],
 ["justin.rb", 11.6265380382538],
 ["james.rb", 12.3434510231018],
 ["eugene.rb", 12.9024469852448],
 ["jesus.rb", 13.2812840938568],
 ["erik.rb", 13.3421401977539],
 ["simon.rb", 14.0733840465546]]

sorted by sys time
[["simon.rb", 0.796875],
 ["steved.rb", 1.3046875],
 ["adam.rb", 1.5078125],
 ["justin.rb", 1.515625],
 ["jesus.rb", 1.765625],
 ["eugene.rb", 2.265625],
 ["erik.rb", 2.421875],
 ["james.rb", 2.4609375]]

sorted by user time
[["simon.rb", 0.078125],
 ["eugene.rb", 0.09375],
 ["jesus.rb", 0.109375],
 ["steved.rb", 0.1171875],
 ["justin.rb", 0.1171875],
 ["james.rb", 0.125],
 ["adam.rb", 0.125],
 ["erik.rb", 0.1953125]]


Here's the benchmark source:

require 'benchmark'
require 'pp'

random_ips = Array.new(1000).map { Array.new(4).map {rand(256)}.join('.') }

sols = Dir["*.rb"] - [$0]

times = {}

sols.each do |fn|
  stats = Benchmark.measure do
    random_ips.each do |ip|
      %x{ ruby #{fn} #{ip} }
    end
  end
  times[fn] = stats
end

sort_times = proc { |m| times.sort_by{|(k,v)| v.send(m)}.map{|(k,v)| [k, v.send(m)]} }

puts "sorted by real time"
pp sort_times[:real]
puts

puts "sorted by sys time"
pp sort_times[:stime]
puts

puts "sorted by user time"
pp sort_times[:utime]


Also, Adam, your solution seems to give incorrect answers sometimes, I noticed 33.33.33.33 and 88.88.88.88 both gave Not Found where as all the other solutions gave US and NO respectively.

- steve