http://rubylution.ping.de/articles/2007/05/29/benchmarking-sorting-arrays-in-descending-order

a.sort { |x, y| y.last <=> x.last } # => " 13.97s 0.013968c/s"
b = a.sort; b.reverse! # => "  3.29s 0.003290c/s"
a.sort_by { |x| -x.last } # => "  2.77s 0.002766c/s"
Advertisements