Jan Brosius <[EMAIL PROTECTED]>  wrote 

> compared with Ocaml and SML , Haskell is a more sophisticated and more
> elegant language. Does anybody know how efficient the Haskell compiler is
> with regards to impure functional languages.

> will Haskell compiled programs be faster by using more strictness
> annotations; I especially think of Clean where strictness annotations are
> "abundantly" used?


I have programmed a lot of computer algebra in Haskell and found that
there exist Haskell implementations which are, generally, on average, 
good in performance. 
Though, i never compared the performance on the same algorithm.
For example, i expect that programming the simplest `merge' sorting 
in Haskell and in SML, Scheme, would not make much difference in 
performance.

On the other hand, the programmer is sometimes bitten by the so-called
un-needed laziness. For example, programming
  sum :: Num a => [a] -> a,  minimum :: Ord a => [a] -> a,   and such,

in different styles, it is hard to predict which of the programs will
take the run-time space proportional to the given list and which take
the constant space. 
Iteration often turns into recursion when evaluated lazily.

Strictness annotations in the data declarations (`!' - fields) often 
increase (a little) the efficiency, only need to be set in the right 
places, there is a simple consideration where to set them.

While setting the strictness in the *functions* leads to that you
would, probably, have a strict copy almost for each function in you 
program system (this is my impression, i am not very sure).
Then, is not it better to write the whole thing in SML ?
To my mind, the only (?) purpose of the laziness is to make the 
program look simpler, more algebraic. Setting the strictness in the 
functions destroys this effect.


------------------
Sergey Mechveliani
[EMAIL PROTECTED]






Reply via email to