So with a fairly extensive set of Cython wrappers, running a fairly large, heavy VRML world with transparencies and all the rest, I see a noticeable, but modest, speedup.
The world I'm testing on goes from ~12.8fps (avg) to 15.5fps (avg), that's a nice 20% speedup. On average OpenGLContext now spends around 20% of rendering time in PyOpenGL calls. Rendering is around 15% of total (most of the time is spent sleeping/waiting and/or processing scenegraph updates and events), for 3-4% of total application time spent in OpenGL and wrapper overhead.
If I were just worried about OpenGLContext performance, I'd stop working on PyOpenGL optimization. It is nowhere near the "big issue" in performance for OpenGLContext now, but PyOpenGL is used by a lot more projects and there's savings that could be had if I were to more tightly bind the Cython wrappers so that they directly call C APIs instead of Python generic object APIs where possible. There are also still a number of converter/arrayhelper types that could be profitably converted to Cython for modest wins.
I have *not* tried to link OpenGL into Cython. At the moment all calls are still through ctypes Function objects, which is a noticeable overhead, but should keep the build system relatively simple. Cython is linking against numpy for one module, but hopefully that will be relatively painless.
The accelerator module is going to need a lot of testing, as is the unaccelerated version. I've already fixed multiple bugs in the non-Cython wrapper module as a result of testing this evening. I might put in another 2 days on the optimization and cleanup/testing, at which point I should probably think about looking for some contracts and getting back to having an income.
Pingbacks are closed.