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 =
g.title = ‘CodeRay Scanner tests’

data = {}
other = 0>> Testing (.?) scanner <<.?^Finished in ([\d.]+)s/m) do |lang, secs|
secs = secs.to_f
if secs > 2
data[lang] = secs
other += secs

  1. 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| lang, secs
end ‘other’, other if other > 0

g.write ‘tests_pie.png’

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 =
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
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”
puts ‘CodeRay’, data
g.labels = labels

g.write ‘languages_over_time.png’

Say something! / Sag was!

"'>kkk<u>kkkk @ 09:27 on Sunday, 2012-11-18

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