Technically yes but, so far, we’re not doing any
compiling. It will make my life harder because it means releases have to
be compiled on each platform/architecture whereas right now the pip
installer gets wrapped up once and works everywhere.
Python extensions are considerably easier to compile nowadays across platforms. Microsoft supplies a compiler specifically for building extensions for Python that setuptools picks up. However, I did need additional libraries like GLEW to access OpenGL +2.0 functions. I see your point, moving to compilers will complicate things and might not be necessary given some tests I did …
I did experiment using extensions by overriding methods in the Window class that make OpenGL calls. It actually worked! But the performance gain was negligible, so I’m assuming the frame drops might be driver related. In addition, PTB fails sync tests on this machine (Win 10, i7 XPS workstation GTX 650, dual 1080p) when throwing up a stereo screen (mode 5) with no drawing in the main loop. On the other hand, in 1000 flips PyschoPy misses a dozen or so frames by +/- 4ms but runs at a solid 60Hz when drawing text to off-screen buffers and blitting to a window spanning multiple screens (current stereo branch). I’m still trying to figure out what’s happening here to cause the difference, but C extensions in PsychoPy’s core might be overkill.
What problems might this solve? You’ll get significant boosts on
things where there are lots of python calls being made but so far I’ve
always got round this by optimising Python/OpenGL code (e.g.
ElementArrayStim). Generally a single line of python code will have very
The stereo rendering pipeline I’m working on makes several context binding calls which are expensive, there is no way around this. However, my extensions didn’t speed up the process much given we are already hitting a performance ceiling. Any dropped frames seems to be a driver issue or something else interrupting consistent timing.
At this point I must agree, PsychoPy can work well with C extensions doing rendering, but it does an excellent job without them.