/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
 binary-trees±±
 nsieve±±
 partial-sums±1/2±
 spectral-norm±±
 n-body±1/2±
 fasta±
 recursive1/2±
 mandelbrot1/21/2
 nsieve-bits±±
 k-nucleotide±
 pidigits±
 reverse-complement±
 Clean used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(CPU secs)±±±

± 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
 binary-trees 
Clean3.9816,868539  
C++ GNU g++4.476,996541  
 nsieve 
Clean2.089,324394  
C++ GNU g++2.085,764313  
 partial-sums 
Clean4.18508577  
C++ GNU g++4.05852531  
 spectral-norm 
Clean27.321,404572  
C++ GNU g++23.84900442  
 n-body 
Clean17.285201587  
C++ GNU g++14.629321705  
 fasta 
Clean28.772,8201420  
C++ GNU g++18.727881248  
 recursive 
Clean3.80596422  
C++ GNU g++2.401,008566  
 mandelbrot 
Clean4.96472506  
C++ GNU g++3.028961097  
 nsieve-bits 
Clean6.414,844464  
C++ GNU g++3.863,316494  
 k-nucleotide 
Clean13.6178,0321511  
C++ GNU g++7.469,3041380  
 pidigits 
Clean3.422,624563  
C++ GNU g++1.661,052652  
 reverse-complement 
Clean1.2043,080834  
C++ GNU g++0.5413,288810  
 regex-dna 
No program
C++ GNU g++1.142,9601588  

 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 

Clean 2.2

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