Ruby 1.9 SUPPORT_JOKE の bitblt を試してみる

$ cat bitblt.rb
def bitblt
  c = nil
  10000.times {
    a = [1, 1606, 396, 933960, 3775901511, 1044, 244711859]
    b = a.map {|i|
      s = ''
      while i > 0
        i, a = (i-1).divmod(26)
        s << 97 + a
      end
      s.reverse
    }
    b[3] += ','
    c = b.join(' ')
  }
  c
end

p bitblt
$ time ruby-1.8.7 -v bitblt.rb
ruby 1.8.7 (2008-06-20 patchlevel 22) [i686-linux]
"a bit of bacon, lettuce and tomato"

real	0m4.518s
user	0m2.028s
sys	0m0.012s
$ time ruby-1.9.0-3-support-joke -v bitblt.rb
ruby 1.9.0 (2008-07-25 revision 18217) [i686-linux]
"a bit of bacon, lettuce and tomato"

real	0m0.113s
user	0m0.016s
sys	0m0.008s

Ruby 1.9 ではとてもはやくなっていますね!(棒読み)