Description of Benchmarks

The benchmarks described below are portable R7RS programs. None define any libraries. Each description of a benchmark begins with a link to its source code, omitting the part that is shared by all of these benchmarks.

All of these benchmarks, their inputs, and the Unix script used to run them, are online and can be downloaded using git.

The timings report execution time only, as calculated using current-jiffy.


Gabriel Benchmarks


browse
Browsing a data base, a Gabriel benchmark, 10 thousand iterations. [May be a test of string->symbol and/or symbol->string.]

deriv
Symbolic differentiation, a Gabriel benchmark, one hundred million iterations.

destruc
Destructive list operations, a Gabriel benchmark, 20 thousand iterations of a 600x50 problem.

diviter
Divides 1000 by 2 using lists as a unary notation for integers, a Gabriel benchmark, 5 million iterations. This benchmark tests null?, cons, car, cdr, and little else.

divrec
This benchmark is the same as diviter except it uses deep recursion instead of iteration.

puzzle
Combinatorial search of a state space, a Gabriel benchmark, 5000 iterations. A test of arrays and classical compiler optimizations. This benchmark was originally written in Pascal by Forrest Baskett.

triangl
Another combinatorial search similar to puzzle, a Gabriel benchmark, 250 iterations.

tak
A triply recursive integer function related to the Takeuchi function, a Gabriel benchmark. 1 iteration of (tak 42 20 11). A test of non-tail calls and arithmetic. [Historical note: The Symbolics 3600 performed 1 iteration of (tak 18 12 6) in 0.43 seconds using generic arithmetic. On our MacBook Air, Larceny runs that benchmark in 0.000096 seconds. That's over 4000 times as fast.]

takl
Calculates (tak 42 20 11) using the same recursive algorithm as for the tak:42:20:11 benchmark but using lists to represent integers. This too was a Gabriel benchmark (with different arguments). 1 iteration.

ntakl
The takl benchmark contains a peculiar boolean expression. Rewriting that expression into a more readable idiom allows some compilers to generate better code for it.

cpstak
The tak:42:20:11 benchmark in continuation-passing style, 1 iteration. A test of closure creation.

ctak
The tak:32:16:8 benchmark in continuation-capturing style, 5 iterations. A test of call-with-current-continuation.

Numerical Benchmarks


fib
Doubly recursive computation of the 40th fibonacci number (102334155), using (< n 2) to terminate the recursion; 10 iterations.

fibc
A version of fib that uses first class continuations; written by Kent Dybvig. Calculates the 40th Fibonacci number (102334155) only once.

fibfp
Calculation of the 40th Fibonacci number using inexact numbers; 10 iterations. A test of floating point arithmetic. Uses essentially the same code as the fib benchmark.

sum
Sums the integers from 0 to 1000, 5 million iterations. (Performs the same number of additions as the sumfp benchmark described below, but avoids the bignum arithmetic that would be needed on some systems by performing a thousand times as many iterations of a problem that's a thousand times as small.)

sumfp
Sums the integers from 0 to 1e6, 5 thousand iterations. A test of floating point arithmetic. Uses essentially the same code as the sum benchmark.

fft
Fast Fourier Transform on 65536 real-valued points, 1000 iterations. A test of floating point arithmetic.

mbrot
Generation of a Mandelbrot set, 25 iterations on a problem of size 1000. A test of floating point arithmetic on reals.

mbrotZ
Same as the mbrot benchmark, but using complex instead of real arithmetic.

nucleic
Determination of a nucleic acid's spatial structure, 200 iterations. A test of floating point arithmetic, and a real program.

pi
A bignum-intensive benchmark that calculates digits of pi.

chudnovsky
Computes digits of PI using a straightforward implementation of the Chudnovsky brothers algorithm. That algorithm is considerably faster than the algorithm used by the pi benchmark above, so we use 20 times as many iterations.

pnpoly
Testing to see whether a point is contained within a 2-dimensional polygon, 2 million iterations (with 12 tests per iteration). A test of floating point arithmetic.

ray
Ray tracing a simple scene, 250 iterations. A test of floating point arithmetic. This program is translated from the Common Lisp code in Example 9.8 of Paul Graham's book on ANSI Common Lisp.

simplex
Simplex algorithm, 5 million iterations. A test of floating point arithmetic, and a real program.

Kernighan and Van Wyk Benchmarks

Brian W Kernighan and Christopher J Van Wyk wrote a set of small benchmarks to compare the performance of several scripting languages, including C and Scheme. Marc Feeley and I modified some of these benchmarks to correct bugs and to increase the number of iterations. When I translated them into R6RS Scheme, I rewrote most of them into slightly more idiomatic Scheme.


ack
A version of the Ackermann function, with arguments 3,13. Just one iteration.

array1
This benchmark allocates, initializes, and copies some fairly large one-dimensional arrays. 1 thousand iterations on a problem size of one million.

string
This tests string-append and substring, and very little else. 5 hundred iterations on a problem size of 500000.

sum1
This benchmark reads and sums 100,000 floating point numbers 100 times. It is primarily a test of floating point input.

cat
This file-copying benchmark is a simple test of character i/o. It copies the King James Bible 100 times.

tail
This benchmark performs considerable character i/o. It prints the King James Bible verse by verse, in reverse order of the verses, 100 times.

wc
Another character i/o benchmark. It counts the number of words in the King James Bible 250 times.

More Input/Output Benchmarks


read1
Reads nboyer.scm 10 thousand times.

Other Benchmarks


compiler
A compiler kernel that looks as though it was written by Marc Feeley. 10 thousand iterations on a 47-line input.

conform
A type checker written by Jim Miller, 1000 iterations.

dynamic
Dynamic type inference, self-applied, 1000 iterations. Written by Fritz Henglein. A real program.

earley
Earley's parsing algorithm, parsing a 15-symbol input according to one of the simplest ambiguous grammars, 3 iterations. A real program, applied to toy data whose exponential behavior leads to a peak heap size of half a gigabyte or more.

graphs
This program was provided by Andrew Wright, but we don't know much about it, and would appreciate more information. This higher order program creates closures almost as often as it performs non-tail procedure calls. Ten iterations on a problem of size 7.

lattice
Another program that was provided by Andrew Wright, though it may have been written by Jim Miller. It enumerates the order-preserving maps between finite lattices. 25 iterations.

matrix
Another program that was provided by Andrew Wright. Computes maximal matrices; similar to some puzzle programs. 10 thousand iterations on a problem of size 5.

maze
Constructs a maze on a 20x7 hexagonal grid, 100 thousand iterations. Written by Olin Shivers.

mazefun
Constructs a maze on an 11x11 rectangular grid using purely functional style, 50 thousand iterations. Written by Marc Feeley.

nqueens
Computes the number of solutions to the 13-queens problem, 10 times.

paraffins
Computes the number of paraffins that have 24 carbon atoms, 10 times.

parsing
Parses the nboyer benchmark 10 thousand times using a scanner and parser generated using Will Clinger's LexGen and ParseGen, which are the tools used to create Larceny's read procedure.

peval
Partial evaluation of Scheme code, 10 thousand iterations. Written by Marc Feeley.

primes
Computes the primes less than 10000 using a list-based Sieve of Eratosthenes. One thousand iterations. Written by Eric Mohr.

quicksort
This is a quicksort benchmark. (That isn't as obvious as it sounds. The original quicksort benchmark distributed with Gambit was a bignum benchmark, not a quicksort benchmark. See the comments in the code.) Sorts a vector of 10000 random integers 5 thousand times. Written by Lars Hansen, and restored to its original glory by Will Clinger.

scheme
A Scheme interpreter evaluating a merge sort of 30 strings, 300 thousand iterations. Written by Marc Feeley.

slatex
Scheme to LaTeX processor, 500 iterations. A test of file i/o and probably much else. Part of a real program written by Dorai Sitaram.

Garbage Collection Benchmarks


nboyer
An updated and exponentially scalable version of the boyer benchmark. The nboyer benchmark's data structures are considerably more appropriate than the data structures used in the original boyer benchmarks. These timings are for 1 iteration on a problem of size 6. A test of lists, vectors, and garbage collection.

sboyer
A version of nboyer that has been tuned (by Henry Baker) to reduce storage allocation, making it less of a garbage collection benchmark and more of a compiler benchmark. Only 4 lines of code were changed, and another 7 lines of code were added. These timings are for 1 iteration on a problem of size 6.

gcbench
This program was written to mimic the phase structure that has been conjectured for a class of application programs for which garbage collection may represent a significant fraction of the execution time. This benchmark warms up by allocating and then dropping a large binary tree. Then it allocates a large permanent tree and a permanent array of floating point numbers. Then it allocates considerable tree storage in seven phases, increasing the tree size in each phase but keeping the total storage allocation approximately the same for each phase. Each phase is divided into two subphases. The first subphase allocates trees top-down using side effects, while the second subphase allocates trees bottom-up without using side effects. This benchmark was written in Java by John Ellis and Pete Kovac, modified by Hans Boehm, and translated into Scheme, Standard ML, C++, and C by William Clinger; it has had way too much influence on implementors of production garbage collectors. The timings shown are for 1 iteration on problem size 20.

mperm
The mperm30:10:4:1 benchmark is a severe test of storage allocation and garbage collection. At the end of each of the 30 iterations, the oldest quarter of the live storage becomes garbage. This benchmark is particularly difficult for generational garbage collectors, since it violates their assumption that young objects have a shorter future life expectancy than older objects. The perm9 benchmark that was once (and might still be) distributed with Gambit does not have that property.

Synthetic Benchmarks for R7RS

The R6RS and R7RS added several new features that had not been tested by older benchmarks because they were not a standard part of Scheme. Most of the following synthetic benchmarks were derived from Larceny's test suites for these features.


equal
This benchmark tests the R7RS equal? predicate on some fairly large structures of various shapes, including circular structures.

bv2string
This benchmark tests conversions between bytevectors and Unicode.

Synthetic Benchmarks for R7RS Red Edition

The R7RS Red Edition added several new libraries to those of the R7RS. The following benchmarks test those libraries.


dderiv
This is a table-driven version of the deriv benchmark using hash tables and comparators from the (scheme hash-table) and (scheme comparator) libraries.

bibfreq
This benchmark uses the Red Edition's hash tables and comparators to find the ten words that appear most often within the King James bible. Written by Aziz Ghuloum as an R6RS benchmark, modified for R7RS by Will Clinger.

bibfreq2
Almost the same as the bibfreq benchmark, but uses symbol-hash instead of eq? hashtables. (It looks as though many implementations of eq? hashtables are using symbol-hash already, so this benchmark is probably redundant and should be dropped.)

hashtable0
Tests only eq? and eqv? hashtables. Purely synthetic: does not read the King James bible. Written by Will Clinger.

listsort
Sorts a scrambled list of the Unicode characters. 10 iterations.

vecsort
Sorts a scrambled vector of the Unicode characters. 10 iterations.

list
Tests the lset-adjoin, lset-union, take, and drop procedures of (scheme list).

ilist
Almost the same as the list benchmark, but uses the immutable lists provided by the (scheme ilist) library.

rlist
Similar to the list and ilist benchmarks, but uses the random access lists provided by the (scheme rlist) library. Random access is not actually needed by this benchmark, and random access lists are considerably slower than ordinary lists and immutable lists, so the problem size is reduced from 9 to 8; that's a considerable reduction, because the time required to run this benchmark is (at least) exponential in the problem size.

vector
Almost the same as the list benchmark, but uses vectors instead of lists. Tests the (scheme vector) library.

set
Almost the same as the list benchmark et cetera, but uses the set operations exported by (scheme set) instead of lists or vectors. For this particular benchmark, using those set operations is likely to be considerably slower than using ordinary lists or vectors, so the problem size is reduced from 9 to 7; that's a considerable reduction, because the time required to run this benchmark is (at least) exponential in the problem size.

charset
Uses the character sets of (scheme charset) to parse the King James bible into tokens, which are then parsed to decide which of those tokens are identifiers and which are numbers. Basically a test of the char-set-contains? procedure and a few standard character sets.

stream
Creates an infinite stream of all Pythagorean triples, and then reports the 200th Pythagorean triple found within that stream. A test of (scheme stream).

lseq
Almost the same as the stream benchmark, but uses the lazy sequences of (scheme lseq) instead of streams.

generator
Almost the same as the stream and lseq benchmarks, but uses the generators of (scheme generator) instead of streams or lazy sequences.

text
Tests the immutable texts of (scheme text) on Book I of Thucydides, in both Greek and English, timing traversals, splits, and joins.