Dear haskell-cafe,
I implemented the Floyd Warshall algorithm for finding the shortest
path in a dense graph in Haskell, but noted the performance was
extremely poor compared to C. Even using mutable unboxed arrays it was
running about 30 times slower. I rewrote the program several times, to
Hello Mathieu,
Friday, April 16, 2010, 12:06:06 PM, you wrote:
actions and then running them using sequence_. But still this program
runs 3 times slower than it's C counterpart:
ghc low-level code optimization cannot be compared with best modern C
compilers that's result of 20 years of
Hi Bulat,
ghc low-level code optimization cannot be compared with best modern C
compilers that's result of 20 years of optimization. ghc generates
machine code in rather simple idiomatic way, so it should be compared
to non-optimizing C compiler
Sure. But I was curious if to see whether
Hello Mathieu,
Friday, April 16, 2010, 12:42:29 PM, you wrote:
Sure. But I was curious if to see whether there was some optimization
I had missed, seeing as other similarly low level programs, such as
the nsieve benchmark of the language shootout, or the word counting
program, manage to run
For what is is worth:
$ ghc -cpp -O2 -ddump-asm Main.hs Main.s
$ time ./a.out
Allocating ...
Allocating ... done
real0m39.487s
user0m39.258s
sys 0m0.150s
$ ~/Programming/Checkouts/ghc.llvm/inplace/bin/ghc-stage2 -cpp -fllvm
-O2 Main.hs
$ time ./a.out
Allocating ...
Allocating ...
On 16/04/2010, at 18:06, Mathieu Boespflug wrote:
shortestPath :: [(Int, Int, Int)] - UArray Int Int
shortestPath g = runSTUArray $ do
let mnew = newArray (0, SIZE * SIZE) 1
mread arr i j = unsafeRead arr (i * SIZE + j)
mwrite arr i j x = unsafeWrite arr (i * SIZE + j) x
From: Mathieu Boespflug mb...@tweag.net
Dear haskell-cafe,
I implemented the Floyd Warshall algorithm for finding the shortest
path in a dense graph in Haskell, but noted the performance was
extremely poor compared to C. Even using mutable unboxed arrays it was
running about 30 times
Hi John,
your transformation on the original program amounts to replacing all
occurrences of a Haskell literal with a Haskell variable. You will
therefore end up with something that looks like this :
loop sIZE = return ()
loop j = ...
sIZE is now a pattern variable, that is, the pattern of the
Hello John,
Friday, April 16, 2010, 7:41:06 PM, you wrote:
sIZE = 1500
and all references from SIZE to sIZE, something ... changes. A lot.
this one too? :D
let loop2 SIZE = return ()
--
Best regards,
Bulatmailto:bulat.zigans...@gmail.com
Am Freitag 16 April 2010 17:41:06 schrieb John Lato:
From: Mathieu Boespflug mb...@tweag.net
Dear haskell-cafe,
I implemented the Floyd Warshall algorithm for finding the shortest
path in a dense graph in Haskell, but noted the performance was
extremely poor compared to C. Even using
On Fri, Apr 16, 2010 at 5:02 PM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
Am Freitag 16 April 2010 17:41:06 schrieb John Lato:
From: Mathieu Boespflug mb...@tweag.net
Dear haskell-cafe,
I implemented the Floyd Warshall algorithm for finding the shortest
path in a dense graph in
11 matches
Mail list logo