Benchmarks

Efficiency is intelligent laziness - David Dunham

Contents

This page contains a collection of JCHR benchmarks useful to measure JCHR's performance and compare it to other (CHR) systems.

The Prolog-counterparts of these benchmarks can be found on the K.U.Leuven CHR System website. The union-benchmark is based on the benchmarks found on the following online appendix: Union-Find in CHR.

The benchmarks

The benchmarks can be downloaded here: [benchmarks.zip]. The archive contains the following benchmarks (including source):

Name Description Required handler(s)
union Taking the union of N elements in a specific manner guf, iuf
fib Calculates the first N Fibonacci numbers fib
primes Calculates prime numbers up to N primes
leq Solves a circular chain of N lesser-than-or-equal variables leq
bool N-digit binary addition bool
mergesort Sorts an array N times using a mergesort algorithm mergesort
dijkstra Calculates the shortest path in several Hamiltonian cycles. For more information, please consult the paper by Jon Sneyers et al. [extented report] dijkstra
(and fib_heap)
ram Counts from 1 to N on a simulated RAM machine ram

To run a K.U.Leuven JCHR benchmark the corresponding (compiled!) handler(s) have to be on the Java class search path (cf. above table; all these handlers and more are available from the examples page), as well as of course the K.U.Leuven JCHR runtime system. Also, make sure you have a Java Runtime Environment (JRE) version 1.5 or higher installed [website, download]. More information on how to run a Java program can be found here.

Finally you will also need to include the tool JBench [website, download]. More info on running and configuring JBench tasks can be found in the JBench manual.

A typical benchmark session looks like:

java benchmark.Main name

Alternatively, one can still use:

java uk.org.skeet.jbench.JBench benchmark/name/NameBenchmark.properties

Most users will however prefer the former façade class Main. Only if you want to pass extra parameters, the latter option might be interesting. Of course you have to replace name with one of the values found in the above table. Also, make sure that both the JBench library and the K.U.Leuven JCHR runtime library is on your class search path (you can have a look here if you do not know how to do this).

The following instruction will probably not work (even though you might expect it to):

java -jar jbench.jar benchmark/name/NameBenchmark.properties

The reason is that, if you use the -jar option on the java.exe command line, java.exe will quietly ignore the set environment classpath and any -classpath or -cp command line options. Therefore, the above instruction will only work if the compiled K.U.Leuven JCHR runtime code is accessible from the current working directory (i.e. also not contained in a jar file).

Valid XHTML 1.1 Valid CSS