All of the tests were run with a "stock" Ruby 1.6.4. In this addendum to the article, we'll try some other versions of Ruby and compare them to our original test times.
First, we'll turn on full optimization. The default build of Ruby using gcc uses gcc options "-g" (debug symbols) and "-O2" (most optimizations). We'll try a Ruby with "-O3", gcc's most aggressive optimization level.
We'll also try Ruby 1.7.1 (2001-09-20), the development version at the time of this writing.
CPU seconds to sort a scrambled list of 10,000 consecutive integers
Ruby 1.6.4 (stock) Ruby 1.6.4 (-O3) Ruby 1.7.1 (stock) Ruby 1.7.1 (-O3) Quicksort (in-place) 1.78 1.74 1.69 1.71 Quicksort (copy) 1.46 1.34 1.51 1.39 Combsort 2.52 2.38 2.34 2.28 Bubblesort 861.2 800.31 809.32 790.62 built-in sort 0.01 0.01 0.01 0.009
The results are somewhat mixed but are generally in favor of -O3 and of Ruby 1.7.1. I wonder why Ruby doesn't build with -O3 by default.
You may notice that the Ruby 1.6.4 (Stock) times don't exactly match the times here in the article. When I re-ran the benchmarks to generate this table they took slightly longer than when I originally ran them. I don't know why. But it's more important to have consistent times within a table than that the times in the two tables match exactly, so I used the new times here.