Hey Charles,

The internal format is RGBA, so you might start by seeing if your PNGs have 
an alpha channel or not. I took a quick glance at the module, and it might 
be possible to avoid the re.findall step altogether if the format is 
already the same. 

I'm not super familar with this module, but maybe the code can be rewritten 
to avoid using the `re` module altogether. It's not really doing very 
sophisticated matches anyway. This might be a nice project for someone to 
hack on. 

If you could post a small example snippet of what you're doing, I'll run it 
through vmprof and have a look at it as well. 


On Sunday, July 2, 2017 at 7:59:26 AM UTC+9, Charles wrote:
>
> I have been profiling my code lately trying to improve performance, 
> especially at startup. I am not too experienced with the ins and outs of 
> pyglet and image data in general, but after profiling it seems a big chunk 
> of time is spent on loading my large atlas files.  They range anywhere from 
> 1024-2048 width or height.
>
> In my profiling it took 0.818 seconds on a Core i5 processor to load 5 of 
> them. I can only image how long it takes on a slower machine. After digging 
> deeper it seems a majority of the time is spent in pyglet.image._convert, 
> specifically the re.findall portion (over 90% of the time is spent on 
> that). Since I doubt we can improve the speed of a default library, I 
> looked at the comment where the findall is found and it says: "Pitch is 
> wider than pixel data, need to go row-by-row." which forces it to do a 
> findall.
>
> Is this because of my image format (PNG) or size? Would a different format 
> produce better results or a way around needing for it to findall? Any input 
> is appreciated, thanks.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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