Как вы используете GeoKit?На моей машине для вычисления расстояния между 2000 точками требуется 0,016 с.
require 'benchmark'
require 'geokit'
ll_arr = 2000.times.map {|i|
[Geokit::LatLng.new(rand(-180..180), rand(-180...180)),
Geokit::LatLng.new(rand(-180..180), rand(-180...180))]}
distances = []
Benchmark.bm do |x|
x.report do
ll_arr.each do |ll|
distances << ll[0].distance_from(ll[1], :units=>:kms)
end
end
end
10.times do |n|
m = n * 200
puts "ll #{m} from: #{ll_arr[m][0]} to: #{ll_arr[m][1]} distance: #{distances[m]}"
end
Выходы:
user system total real
0.016000 0.000000 0.016000 ( 0.015624)
И результаты кажутся разумными (в километрах):
ll 0 from: -180,71 to: 111,164 distance: 10136.21791028502
ll 200 from: 40,-127 to: -62,-23 distance: 14567.00843599676
ll 400 from: 23,-178 to: -163,-140 distance: 16014.598170496456
ll 600 from: 85,155 to: 25,3 distance: 7727.840511097989
ll 800 from: -26,57 to: 145,-36 distance: 11384.743155770688
ll 1000 from: -111,-137 to: 5,-5 distance: 9007.969496928148
ll 1200 from: 118,-98 to: -153,179 distance: 12295.886774709148
ll 1400 from: 44,-139 to: -91,-134 distance: 15024.485920445308
ll 1600 from: 48,126 to: -37,-92 distance: 16724.015574628884
ll 1800 from: -174,-77 to: -69,75 distance: 7306.820947156828