We all like to see how fast our programming languages are. Here I was interested in how some Scheme implementations compared with an equivalent C++ program (and each other).

The program is ferret, a text comparison program which works out how similar pairs of documents are. The C++ implementation is wrapped as a Ruby gem: uhferret-gem. An R7RS Scheme version and an R6RS version were created, and tested with Gauche (0.9.6), Sagittarius (0.8.4) and Chez Scheme (9.4.1). (The scheme versions are at chezferret.)

The tests were against a directory of text documents, containing varying numbers of words.

Sagittarius and Gauche perform poorly as the number of words increase, and the lines show exponential tendencies. However, let’s zoom in on the bottom of the graph:

Look carefully: Chez Scheme comes below the C++ line: on these data, Chez Scheme is the fastest!

The raw numbers (times in seconds)

Millions C++ Chez Sagittarius Gauche
1 5.4 3.6 42.8 73.4
2 10.6 7.3 200.2 229.0
3 15.0 12.0 298.4 393.8
4 23.0 17.3 734.7 816.8