Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Observations on OCaml vs. Haskell
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Keith Wansbrough <Keith.Wansbrough@c...>
Subject: Re: [Caml-list] Observations on OCaml vs. Haskell
> and both languages seem to be significantly slower than OCaml in string
> handling, at least as far as this site goes:
> 
> http://shootout.alioth.debian.org/
> 
> For the word count benchmark OCaml scores 0.1850 seconds, while GHC is a
> dismal last place at 105.2110 seconds!  Even the bytecode ocaml is an
> order of magnitude faster.  The word frequency benchmark also shows this
> kind of poor string handling performance for Haskell, with OCaml scoring
> 0.5669 seconds, while GHC scores a truly dismal 6.4540, more than an
> order of magnitude slower, and even the bytecode ocaml is faster at
> 4.2644 seconds.

I severely doubt that these times are representative - the shootout
doesn't claim to be serious or meaningful.  A factor of ten is
possible, but a factor of 1000 shows that something else is wrong.

But it's true that for text-handling performance in GHC you have to
use something other than list-of-Char; typically you use PackedString,
which is basically an array of bytes.  The boxing and unboxing
certainly has significant cost.

Note that GHC characters are Unicode, and stored in 32 bits; OCaml
characters are only 8 bits wide, and so OCaml has a 4x advantage right
away - but loses the potential for i18n.

HTH.

--KW 8-)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners