Hi guys, 

I did a minor performance tweak to the Sprite class's _update_position 
method a while ago, and thought I'd share it. You can see it in my 
"sprite_optimization" branch here:
https://bitbucket.org/treehousegames/pyglet/src/124e1fe4c0016cf9effcf3c1706c0124aa99712e/pyglet/sprite.py?at=sprite_optimization&fileviewer=file-view-default
Basically it's just cutting out the temporary vertex list creation, and 
removing a if/else few checks. I've tested it with a few thousand sprites, 
and this nets a few extra FPS. Not a major improvement, but it's also a bit 
easier to read the method in my opinion. 

The only drawback to this tweak is that Sprite vertex_lists are always 
created as float arrays, even if sprite subpixel is not used. This is to 
avoid one of the if/else checks in the method. It is my understanding that 
on modern GPUs (last 10 years), floats are used internally anyway, so this 
shouldn't hurt performance any. 

Would this make sense to try to get merged in, or is there some glaring 
issue that I'm missing?

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyglet-users+unsubscr...@googlegroups.com.
To post to this group, send email to pyglet-users@googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to