[Haskell-beginners] Performance problem with Haskell/OpenGL/GLFW

Jesper Särnesjö sarnesjo at gmail.com
Fri Mar 8 13:25:34 CET 2013


Hi there!

My first post here. :)

I have a curious performance problem with a Haskell/OpenGL/GLFW
program that I just can't figure out.

The program's CPU usage is quite high in general, and increases with
the number of pixels redrawn per frame. It uses OpenGL 3.2, does most
of its work on the GPU, and should do a constant amount of work per
frame on the CPU, so this makes little sense.

I've created a smaller program (still 91 lines, though), which renders
a single triangle, but still reproduces this problem. If I make the
triangle smaller (by editing vertexData), CPU usage goes down, and if
I make it bigger, CPU usage goes up. [1]

I've also created a C program which does the same thing (as far as
possible), but which does not exhibit this problem. CPU usage is far
lower, and stays constant regardless of the number of pixels redrawns
per frame. [2]

The library functions I use (from OpenGLRaw-1.3.0.0 and
GLFW-b-0.1.0.5) are only thin wrappers around their C counterparts, so
I strongly believe the problem is in my program.

Any thoughts?

-- 
Jesper Särnesjö
http://jesper.sarnesjo.org/

[1] https://gist.github.com/sarnesjo/5116084#file-test-hs
[2] https://gist.github.com/sarnesjo/5116084#file-test-c



More information about the Beginners mailing list