I recently used cProfile (in concert with RunSnakeRun, to give a graphical display of the output) and in five minutes I had found that 80% of my pyglet game's execution time was spent in a single line of code. (an ill-considered slice of vertices across the ctypes boundary) Fixing that single line boosted my game framerate by a factor of four or more.
Highly recommended. On May 26, 12:47 am, Casey Duncan <[email protected]> wrote: > On Mon, May 25, 2009 at 5:00 PM, Tristam MacDonald <[email protected]> > wrote: > > On Mon, May 25, 2009 at 6:51 PM, mclovin <[email protected]> wrote: > > >> I just have one quick question, is there anyway to test to see if my > >> coding is actually helping the speed increase? Where I develop I have > >> a a pretty highend machine so it maxes out at 60fps all the time > >> (unless I do something stupid). but at home the computer which I am > >> making the program for is significantly slower but I can only test my > >> program on it about every 3-4 days. Is there a tool or anything that > >> will let me see if my efforts at optimization are actually paying off > >> before I get home to test it? > > > One simple solution is to disable vsync (pass the kerword argument > > vsync=False to the window constructor). > > Note however that frames-per-second is a very poor measure of performance, > > and you should probably compare average time-per-frame instead. Since > > frames-per-second is 1/time-per-frame, a huge change in frames-per-second > > may be only a very time change in time-per-frame. > > If you do measure average time per frame, it would also be worthwhile > to calculate the std deviation so you know how even your frame times > are. Uneven frame rates are even worse than low frames rate IMO. > > To get an overall measure of your CPU performance, use cProfile > (python -m cProfile), which will give you an idea where your program > is spending most of it's time and what code would be beneficial to > optimize. > > -Casey --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
