Re: [PyOpenGL-Users] Perl vs. Python OpenGL bindings benchmarks
Brought to you by:
mcfletch
From: Aleksandar B. S. <asa...@gm...> - 2007-06-05 10:09:52
|
On 6/5/07, Mike C. Fletcher <mcf...@vr...> wrote: > Here's what a cProfile run of their "benchmark" method shows (they had a > .tar.gz on the site, I'd thought it was just the one file, it includes > the whole suite): > > [ snip ] > Mike, Thanks for running cProfile on this benchmark, and for providing results. Everything is as expected, I'd say - overhead regarding using Python arrays is not that big after all, error checking is indeed taking lots of running time, and most of running time is spent in actually awaiting OpenGL to complete drawing (which is very interesting in itself, because it shows that wrappers are probably not a bottleneck at all). So overall, I think we're good, I'll try to work with POGL guys to have PyOpenGL based benchmark properly run on their machines, so that they could eventually confirm what I'm seeing on my machine (that both wrappers are approximately of same performance), and update results on their site. As for passing arrays to glVertexPointer: so what would be your suggestion on best approach to accomplish this (if we're talking about large arrays, and if we put aside that we should be doing all of this in C instead of Python)? I tried to replace using ctypes arrays with using numpy arrays in trislam_pyopengl_ctp.py, and then to use glVertexPointer() (with 4 arguments) instead of glVertexPointerf() (with 1 argument); diff is attached (against trislam_pyopengl_ctp.py from POGL site) and benchmark results are practically unchanged... Regards, Alex ------------ [alex@r51 trislam]$ diff trislam_pyopengl_ctp.py trislam_pyopengl_num.py 24c24 < import ctypes --- > import numpy 88c88 < data = (ctypes.c_float * 2 * (count * count * 4))() --- > data = numpy.empty((count * count * 4, 2), numpy.float32) 104c104 < data = (ctypes.c_float * 2 * (count * (count + 1) * 2))() --- > data = numpy.empty((count * (count + 1) * 2, 2), numpy.float32) 116c116 < data = (ctypes.c_float * 2 * (count * count * 6))() --- > data = numpy.empty((count * count * 6, 2), numpy.float32) 137c137 < data = (ctypes.c_float * 2 * (count * (count + 1) * 2))() --- > data = numpy.empty((count * (count + 1) * 2, 2), numpy.float32) 171c171 < glVertexPointerf(va) --- > glVertexPointer(2, GL_FLOAT, 0, va) 198c198 < glVertexPointerf(va) --- > glVertexPointer(2, GL_FLOAT, 0, va) 213c213 < glVertexPointerf(va) --- > glVertexPointer(2, GL_FLOAT, 0, va) 245c245 < glVertexPointerf(va) --- > glVertexPointer(2, GL_FLOAT, 0, va) 273c273 < glVertexPointerf(va) --- > glVertexPointer(2, GL_FLOAT, 0, va) 288c288 < glVertexPointerf(va) --- > glVertexPointer(2, GL_FLOAT, 0, va) |