/mobile Handheld Friendly website

÷

 Step 1 : Are the Clean programs faster? At a glance.

This chart shows 3 comparisons - Time-used, Memory-used and Code-used ~ speed and size.

Each chart bar shows, for one unidentified benchmark, how much the fastest Clean program used compared to the fastest C++ GNU g++ program.


Look at speed another way - look at a box plot of Time-used data.

 Step 2 : Are the Clean programs faster? Approximately.

This table shows 3 comparisons - Time-used, Memory-used and Code-used ~ speed and size.

Each table row shows, for one named benchmark, how much the fastest Clean program used compared to the fastest C++ GNU g++ program.

 Clean used what fraction? used how many times more? 
Benchmark Time Memory Code
 n-body±±±
 fannkuch-redux±1/21/2
 spectral-norm1/2
 fasta±
 mandelbrot1/971/2
 binary-trees±1/2
 reverse-complement?1/3
 k-nucleotide13×15×1/2
 Clean used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)±±±13×

± read the measurements and then read the program source code.

 Step 3 : Are the Clean programs faster? Measurements.

This table shows 5 measurements - CPU Time, Elapsed Time, Memory, Code and ≈ CPU Load ~ speed and size.

For each named benchmark, measurements of the fastest Clean program are shown for comparison against measurements of the fastest C++ GNU g++ program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 n-body 
Clean22.1322.143361587  0% 0% 0% 100%
C++ GNU g++19.3019.314241659  0% 0% 0% 100%
 fannkuch-redux 
Clean67.4467.46592725  0% 0% 0% 100%
C++ GNU g++50.3550.361,2361440  0% 0% 0% 100%
 spectral-norm 
Clean15.7015.701,380609  0% 0% 0% 100%
C++ GNU g++9.9910.007561044  0% 0% 0% 100%
 fasta 
Clean11.5711.575921420  0% 0% 0% 100%
C++ GNU g++6.166.163561266  0% 0% 0% 100%
 mandelbrot 
Clean51.7551.76332506  0% 0% 0% 100%
C++ GNU g++24.2824.2932,3001017  0% 0% 0% 100%
 binary-trees 
Clean43.6443.70262,476539  0% 0% 0% 100%
C++ GNU g++17.2317.29296,252892  0% 0% 0% 100%
 reverse-complement 
Clean0.330.3487,972834  3% 3% 0% 100%
C++ GNU g++0.120.12?2275  8% 0% 0% 100%
 k-nucleotide 
Clean125.07128.142,097,5401511  0% 0% 0% 100%
C++ GNU g++9.859.87142,1243415  0% 0% 1% 100%
 regex-dna 
No program
C++ GNU g++0.050.08?695  11% 0% 0% 89%
 fasta-redux 
No program
C++ GNU g++0.030.03?1474  0% 0% 25% 100%
 pidigits 
CleanMake Error
C++ GNU g++0.080.08?682  0% 0% 0% 100%

 Step 4 : Are there other Clean programs for these benchmarks?

Remember - those are just the fastest Clean and C++ GNU g++ programs measured on this OS/machine. Check if there are other implementations of these benchmark programs for Clean.

Maybe one of those other Clean programs is fastest on a different OS/machine.

 Step 5 : Are there other faster programs for these benchmarks?

Remember - those are just the fastest Clean and C++ GNU g++ programs measured on this OS/machine. Check if there are faster implementations of these benchmark programs for other programming languages.

Maybe one of those other programs is fastest on a different OS/machine.

 Clean : lazy & strict pure functional programming 

clm - Clean make - version 2.4

Home Page: Clean

Download: Download Clean


We've made the Clean programs a little more obvious by providing these library functions:

import StdEnv, ArgEnv

                                             
// The first commandline arg (if it will convert to Int) otherwise 1

argi :: Int
argi = if (argAsInt <= 0) 1 argAsInt
   where
      argv = getCommandLine
      argAsInt = if (size argv == 2) (toInt argv.[1]) 1


// Round to n decimal places & convert to String 

toStringWith :: !.Int !.Real -> {#Char}     
toStringWith n a
   # z = 10.0 ^(~ (toReal n))   
   # x = (0.5 * z) + abs a
   # (s,exp) = ndigits x z (entier x) (nsign a) 0
   # (s,exp) = nzeros s exp True
   = s

   where
   nsign x = if (x<0.0) "-" ""
      
   ndigits x z i s exp
      | x<z = (s,exp)
      # x = (x - toReal i)*10.0
      = ndigits x (z*10.0) (entier x) 
         ((if (exp == -1)(s +++ ".") s) +++ toString i) (exp-1)

   nzeros s exp point
      | exp < ~n = (s,exp)
      | (exp == -1 && point) = nzeros (s +++ ".") exp False
      = nzeros (s +++ "0") (exp-1) point 

Revised BSD license

  Home   Conclusions   License   Help