A computer thinks I write like
David Foster Wallace
Fri 2010-01-08 ( En pr pi )

I compiled a pie graph of times needed for CodeRay scanner tests. More test data for a language means more time to run the tests.

As you can see, I have a lot of tests for Ruby (60,000 lines of code) and C (70,000), and less for Delphi (11,000). The combined “other” languages are C++, the CodeRay debug format, diff, ERB and Nitro HTML templates, Scheme, and XML.

I used the excellent Gruff graph library.

Here’s the code:

require 'rubygems'
require 'gruff'
 
g = Gruff::Pie.new
g.title = 'CodeRay Scanner tests'
 
data = {}
other = 0
DATA.read.scan(/>> Testing (.*?) scanner <<.*?^Finished in ([\d.]+)s/m) do |lang, secs|
  secs = secs.to_f
  if secs > 2
    data[lang] = secs
  else
    other += secs
  end
end
 
# additional colors
g.add_color '#ff9966'
g.add_color '#889977'
g.add_color '#dd77aa'
g.add_color '#bbddaa'
g.add_color '#aa8888'
g.add_color '#77dd99'
g.add_color '#555555'
 
data.sort_by { |k, v| v }.reverse_each do |lang, secs|
  g.data lang, secs
end
 
g.data 'other', other if other > 0
 
g.write 'tests_pie.png'
 
__END__
Put output of norandom=1 rake test:scanners here!

Update: And here’s a graph of the development of language support in CodeRay over time.

The arrows and version tags were added using Mac OS Preview.

require 'rubygems'
require 'gruff'
 
g = Gruff::Line.new
g.title = 'Supported Languages in CodeRay'
g.hide_dots = true
 
data, labels = [0], {}
repo_creation = Date.parse `svn info -r1`[/Last Changed Date: ([-\d]+)/,1]
index = 1
$stdout.sync = true
for day in repo_creation..Date.today
  if day.mday == 1  # only check on 1st day of the month
    labels[index] = day.year.to_s if day.month == 1
    index += 1
    data << `svn ls lib/coderay/scanners -r{#{day}} | \\
      grep '^[[:alpha:]]\\w\\+.rb' | wc -l`.to_i
    print day, "\r"
  end
end
puts
 
g.data 'CodeRay', data
g.labels = labels
 
g.write 'languages_over_time.png'

Say something! / Sag was!

No markup, just plain monospace text. / Kein Markup, nur Normschrift-Klartext.