Adrian Hey wrote:
On Friday 26 Mar 2004 10:39 pm, Sean E. Russell wrote:
Why is Ocaml so darned fast compared to Haskell?
...
Also, I have a hunch that not only is eager evaluation inherently more efficient (in terms of the raw number of operations that need to be performed), it's probably more cache friendly too (you probably end up with code that looks far more like a traditional imperative loops and whatnot that you'll get by performing "itsy bitsy on demand" graph reduction).
Actually the cache behaviour of code generated by GHC isn't at all bad. I know because I ran a student project a couple of years ago to implement cache-friendly optimisations. The first thing they did was cache profiling of some benchmarks, and to our surprise we discovered the cache behaviour of lazy code is already pretty good. You get a lot of structure in the evaluation of lazy code -- it just isn't evident in the source code! John