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
- Cryptarithm solver - Haskell vs. C++ Mark Engelberg
- Re: Cryptarithm solver - Haskell vs. C++ Lennart Augustsson
- Re: Cryptarithm solver - Haskell vs. C++ Fergus Henderson
- Re: Cryptarithm solver - Haskell vs. C++ Juergen Pfitzenmaier
- Re: Cryptarithm solver - Haskell vs. C++ Adrian Hey
- Re: Cryptarithm solver - Haskell vs. C++ Manuel M. T. Chakravarty
- Re: Cryptarithm solver - Haskell vs. C++ Lennart Augustsson
- Re: Cryptarithm solver - Haskell vs. C++ Lennart Augustsson
- Re: Cryptarithm solver - Haskell vs. C++ Bart Demoen
- Re: Cryptarithm solver - Haskell vs. C++ Herbert Graeber
- Re: Cryptarithm solver - Haskell vs. C++ Fergus Henderson
- Re: Cryptarithm solver - Haskell vs. C++ Manuel M. T. Chakravarty
- Re: Cryptarithm solver - Haskell vs. C++ Manuel M. T. Chakravarty
- Re: Cryptarithm solver - Haskell vs. C++ S.D.Mechveliani
- Re: Cryptarithm solver - Haskell vs. C++ Marcin 'Qrczak' Kowalczyk
- Re: Cryptarithm solver - Haskell vs. C++ George Russell
- Re: Cryptarithm solver - Haskell vs. C++ D. Tweed
