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

Hollister Herhold hollister at fafoh.com
Sun Mar 10 16:01:07 CET 2013


I don't think so - I had to build and install glfw from source to get the Haskell code to link after building glfw-b (which built fine without GLFW installed, incidentally).

I get the following for library dependencies - it looks like they're using the exact same libs (aside from iconv):

hhmacbook:~/Development/haskell/OpenGL:6> otool -L ./a.out 
./a.out:
	@executable_path/libglfw.dylib (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
hhmacbook:~/Development/haskell/OpenGL:7> otool -L ./Test2
./Test2:
	@executable_path/libglfw.dylib (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
hhmacbook:~/Development/haskell/OpenGL:8> 


On Mar 10, 2013, at 9:31 AM, Andrey Yankin wrote:

> Hi.
> 
> AFAIK glfw-b uses its own version of glfw which is built during setup.
> There is a makefile inside the package.
> 
> Can't reproduce this error on Arch.
> 
> 
> 
> 2013/3/10 Hollister Herhold <hollister at fafoh.com>
> 
> OK, I get the same results as you. I ran a dtruss on the two different apps to look at the system calls being made and I can see where the C code opens the OpenGL hardware driver and the haskell code does not, but I'm not sure why. There are a lot of preferences files flying around. Still digging.
> 
> I do know that both apps are using the same glfw library.
> 
> 
> On Mar 10, 2013, at 8:23 AM, Hollister Herhold wrote:
> 
> >
> > I'm building glfw now on 10.7.5 and I'll try your test code.
> >
> > I've been learning haskell (still very much a beginner) but I know OpenGL, so I'm very interested in how this turns out.
> >
> > -Hollister
> >
> >
> > On Mar 10, 2013, at 4:38 AM, Jesper Särnesjö wrote:
> >
> >> On Sun, Mar 10, 2013 at 4:46 PM, Jesper Särnesjö <sarnesjo at gmail.com> wrote:
> >>> I've figured out what the problem is: the Haskell program is using a
> >>> software implementation of OpenGL, so rendering *does* in fact happen
> >>> on the CPU.
> >>>
> >>> It would appear that there is in fact some relevant difference between
> >>> the Haskell and C versions of my program, or possibly some way
> >>> in which the bindings from the GLFW-b package are different from the C
> >>> library.
> >>
> >> To remove any possibility of the problem being in GLFW-b or OpenGLRaw,
> >> I created two new programs, one in Haskell [1] and one in C [2], that
> >> don't import or include anything related to OpenGL, and that simply
> >> create a context, check if it is hardware accelerated, and then exit.
> >> That is all. And still, the Haskell program receives a software
> >> renderer, while the C program receives a hardware one:
> >>
> >>   $ ghc -O2 Test2.hs -lglfw -framework OpenGL -fforce-recomp && ./Test2
> >>   [1 of 1] Compiling Main             ( Test2.hs, Test2.o )
> >>   Linking Test2 ...
> >>   software
> >>   (2,7,7)
> >>   (3,2,0)
> >>   $ gcc -O2 test2.c -lglfw -framework OpenGL && ./a.out
> >>   hardware
> >>   2.7.7
> >>   3.2.0
> >>
> >> I haven't had the chance to run these programs on any OS other than
> >> Mac OS X 10.8.2, so I don't know if this problem is Mac-specific.
> >> Still, it's really weird that the system would differentiate between
> >> Haskell and C programs in this way.
> >>
> >> If anyone has any ideas about what's going on here, I'd very much like
> >> to hear them.
> >>
> >> --
> >> Jesper Särnesjö
> >> http://jesper.sarnesjo.org/
> >>
> >> [1] https://gist.github.com/sarnesjo/5116084#file-test2-hs
> >> [2] https://gist.github.com/sarnesjo/5116084#file-test2-c
> >>
> >> _______________________________________________
> >> Beginners mailing list
> >> Beginners at haskell.org
> >> http://www.haskell.org/mailman/listinfo/beginners
> >
> >
> > _______________________________________________
> > Beginners mailing list
> > Beginners at haskell.org
> > http://www.haskell.org/mailman/listinfo/beginners
> 
> 
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
> 
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130310/1d3adf59/attachment-0001.htm>


More information about the Beginners mailing list