[Haskell-cafe] Climbing up the shootout...

Jonathan Cast jonathanccast at fastmail.fm
Mon Sep 22 16:30:19 EDT 2008


On Tue, 2008-09-23 at 00:20 +0400, Bulat Ziganshin wrote:
> Hello Isaac,
> 
> Monday, September 22, 2008, 11:49:30 PM, you wrote:
> 
> >> i mean that naive haskell code is very slow and 3 or 5 or twelve libs
> >> can't solve the problem of ghc generating slow code
> 
> > Is there something particularly fascinating about naive code written in
> > any language? 
> 
> yes, in asm number of instructions executed more or less define
> number of CPU cycles used.

On modern processors (RISC design), naive asm is likely to be
extraordinarily slow, because memory usage and cache considerations and
register scheduling dominate processor cycles.

> C known as portable asm.

Known as != is.  And naive C is also extraordinarily slow, especially if
written at a high level.  It is not the least bit difficult to write
memory hogs in C.  (I should know; I've done it.  And so has every major
software house (including open source projects) to release in C, for
that matter.)

> Haskell was
> developed with goal to hide implementation details from egg-headed
> scientists and this obviously should have some drawbacks

Should != is.  Not all shoot-out entries look like C with Haskell syntax
(although some do).  Naive Haskell can be 100s of times slower than
well-tuned C; naive C can be 100s of times slower than well-tuned
Haskell (where well-tuned Haskell can just mean using good data
structures.  It's quite naive indeed to dismiss better data structures
and better algorithms (especially where `better algorithms) as
`libraries.)

jcc




More information about the Haskell-Cafe mailing list