Skip to content

Instantly share code, notes, and snippets.

@nirvdrum
Created May 19, 2016 23:05
Show Gist options
  • Save nirvdrum/87c0fbb3740f5fd12f9b8f0610ca2835 to your computer and use it in GitHub Desktop.
Save nirvdrum/87c0fbb3740f5fd12f9b8f0610ca2835 to your computer and use it in GitHub Desktop.
def gen_point
[rand, rand]
end
points = []
10_000.times do |i|
points << [i, gen_point]
end
start = Time.now
puts "Starting sort"
axis = 0
points.sort! { |a, b| a.last[axis] <=> b.last[axis] }
puts "Took: #{Time.now - start}s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment