RE: GlxGears
"Simon Marlow" <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.hopengl |
|---|---|
| Message-ID | <3429668D0E777A499EE74A7952C382D1019D69FE@EUR-MSG-01.europe.corp.microsoft.com> |
> Shawn P. Garbett wrote:
> > [...]
> > Haskell Version on my laptop, FPS = 103
> > C Version on my laptop, FPS = 192
> > [...]
>
> I just gave your example a quick try on my PC, the results do
> not differ
> that much for my setup (SuSE x86 Linux 8.2, 3GHz P4, NVIDIA FX 5900):
>
> Haskell version: 6000 FPS
> C version: 7165 FPS
>
> Curiously, using -O for the Haskell compilation doesn't make
> any difference.
> I'll take a closer look with GHC's profiler and the ltrace
> tool when I get
> some time.
>
> Thanks for the conversion BTW, I'd like to place this example
> into GLUT'S
> "Misc" example directory, with a BSD-like license. Would that be OK?
There's a performance problem we discovered recently in GHC where code
like this:
case _ccall_ f ... of
(# s, r #) -> ...
would result in an out-of-line call to f instead of the expected inline
call. This might affect you. Also, make sure that HOpenGL doesn't use
the FFI facility to specify include files in a foreign import
declaration: this prevents cross-module inlining of the call in GHC.
Otherwise, the usual tricks apply: looks like the code has lots of
Floats sloshing around, so try to get them unboxed as much as possible.
If you store Floats/Doubles in a data structure, try using ! {-# UNPACK
#-}.
Cheers,
Simon