The "speed" of Clean

Pascal Serrarens pascalrs@cs.kun.nl
Thu, 28 Jan 1999 10:57:07 +0100


Mark,

You asked

> When discussing the "speed" of Clean, and comparing it to the "speed"
> of other languages, are people refering to the execution speed of the
> generated code, or are they refering to something else?

I am not going to answer this question directly, because I don't who
said what in which discussions, but I would like to give you some
information about performance of compilers and produced code.
(If you are not interested in references and numbers, skip to the last
lines of this mail)

First, Pieter Hartel wrote, helped by numerous others, a number of
papers on the subject of benchmarking funtional languages:

@article{HartelEA1996a,
 author       = "Hartel, P.H. and others",
 title        = "Benchmarking implementations of functional languages with
                 ``pseudoknot'', a Float-Intensive benchmark.",
 journal      = "Journal functional programming",
 volume       = "6",
 number       = "4",
 pages        = "621--655",
 month        = "July",
 year         = "1996"
}

@inproceedings{HartelLangendoen1993a,
 author       = "Hartel, P.H. and Langendoen K.G.",
 title        = "Benchmarking implementations of lazy functional languages",
 booktitle    = "6th Functional programming languages and computer architecture",
 pages        = "341--349",
 address      = "Copenhagen, Denmark",
 month        = "June",
 year         = "1993",
 publisher    = "ACM"
}

@inproceedings{Hartel1995a,
 author       = "Hartel P.H.",
 title        = "Benchmarking implementations of lazy functional languages II
-- Two years later",
 editor       = "Johnsson T.",
 booktitle    = "Implementation of Functional Languages",
 pages        = "63--68",
 address      = "G\"oteborg, Sweden",
 month        = "Sept",
 year         = "1995"
}

(The papers can be found on http://www.staff.ecs.soton.ac.uk/~phh/myrefs.html)

----

From the Benchmarking II paper (leaving out some other languages):

language      |     Clean     | Glasgow Haskell 

compilation speed in lines per minute

minimum       |         129   |        48
maximum       |        1384   |       153

Heap space and execution time

event         |  16M    24    | 32M    34
wang          |  48M    19    | 40M    15
fft           |  48M     9    |  8M    11
genfft        |  8M      6    | 24M     8
...

Glasgow haskel was in 9 of the 14 tests the fastest, Clean in 2. So from this
paper we conclude that GHC produces faster code, but the Clean compiler is
much faster in producing code.

----

From the Pseudoknot paper:

`Overall the (eager) Sisal compiler achieved the best performance. The next
best is the (lazy) Glasgow Haskell compiler for a heavily optimised version
of the program.

Results giving the time (user+system time in seconds) and space (in Mbytes)
required for compilation of the Pseudoknot program. The 'pseudoknots' give
the relative speed with respect to the execution (not compilation) of the
C version: (leaving out some languages)

            times (user + sys)     space    pseudoknots (higher is better!)
Sisal          112 + 13.3            2.4      12 + 8
Glasgow        564 + 30             47         2 + 3
Clean           30 + 10              9        90 + 10
SML/NJ        40.3 + 2.3            35        22 + 43
SUN CC -O      325 + 26              8         8 + 4
GNU GCC -O     910 + 97             21         3 + 1

The execution times (user + system time in seconds) and space (MB) of
Pseudoknot. (leaving out some languages)

             times (user + sys)    space
Sisal           3.7 + 0.2           0.7
Glasgow         3.9 + 0.2           1
Clean           5.1 + 0.8           2.5
SML/NJ          6.9 + 1.2           2.6
GNU GCC         2.4 + 0.1           0.3

----

Next to that I wrote a paper myself, comparing C, Clean and Glasgow Haskell
for an array-intensive computation:

@inproceedings{Serrarens1997a,
 author       = "Serrarens, P.R.",
 title        = "Implementing the Conjugate Gradient Algorithm in a Functional Language",
 pages        = "125--140"
 booktitle    = "Implementation of Functional Languages, 8th International Workshop,
                 Selected Papers",
 year         = "1997",
 editor       = "Kluge, Werner",
 volume       = "1268",
 series       = "LNCS"
}

From that paper:

Execution times in seconds

problem size  |     C     |   Clean   |    GHC
2500^2        |     0.69  |    0.91   |   13.30
10000^2       |     5.20  |    7.50   |  103.54
40000^2       |    66.20  |   76.24   |     -
160000^2      |   608.75  |  725.50   |     -

----

Note that the papers from Pieter Hartel were written when Clean did not support
arrays yet.

So in general we can say that Clean is much faster in compilation (> 10x). GHC
produces better code for pure functional programs, while Clean is much better
when doing array manipulations.

I hope I clearified some things with it.
(sorry about the long post)

Pascal Serrarens.