So I did a test run too, on a 450MHz Pentuim II running NetBSD.
I used Manuel's Haskell code, but I added a type signature for
the expand function, and the original C++ code.

dogbert% cc c.cc -o c.out -lstdc++
dogbert% time c.out
1942530768
1.043u 0.010s 0:01.05 100.0%    0+0k 0+1io 0pf+0w
dogbert% hbc h3.hs
dogbert% time a.out
[1,9,4,2,5,3,0,7,6,8]
0.761u 0.040s 0:00.80 100.0%    0+0k 0+0io 0pf+0w
dogbert%

So if you compile naively with no optimization the Haskell code
is actually FASTER than the C++ code.

--

        -- Lennart





Reply via email to