[Haskell-cafe] Floyd Warshall performance (again)

Bulat Ziganshin bulat.ziganshin at gmail.com
Fri Apr 16 04:56:48 EDT 2010


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 within a few percentage points of C if not
> faster.

you know it's the big game with $00000's hanging around. sometimes we
rewrite programs, sometimes libs and sometimes compiler itself. the
best way to optimize your program is to add it to shootout itself :)))

i know one case when required function was added to the library and i
know that ghc was added better code generation for short loops.
probably it was enough to shootout programs but not your one. but of
course if making full-fledged optimizing compiler was so easy, it was
made to C and Haskell many years ago

> Since this program doesn't use any features specific to
> functional programming, such as higher order functions, and mostly
> just calls out to imperative primitives of GHC not implemented in
> Haskell (such as unsafeRead and unsafeWrite), I would have thought
> that the gap in runtimes might have been smaller.

it's not runtimes, but code generation. ghc -O2 should be rather close to
gcc -O0. you just undervalue amount of work done in gcc in those 20
years :)


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list