[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Debug printouts - faster to screen or file?



Chris McCormick wrote:
> My program seems to slow considerably when I print a bunch
 > of feedback to the DOS screen (I'm using winblows) with the
 > print statement, like so:
> print "Variable number_of_cows equals:", number_of_cows
> Would it be faster to send these statements to a text file?  

i assume sending this to a file would be faster, since it wouldn't 
require any graphics output to the screen. lots of printing statements 
do have an impact on performance. i'm how much is gained by sending it 
to a file instead.


> If I leave all of these print statements in my code, but comment
 > them out, does the resulting bloat slow down my code in any way?
 > I guess I've never been sure about how the size of include files
 > (i.e., number of lines, whether executed or not) affects program
 > load time.  So maybe another way to say this is:
> 
> If module A has the same number of executing lines as module B,
 > but 5000 lines of comments, does module A load more slowly?

comments will not effect runtime performance. i suppose a huge amount of 
comments lines could effect compile time, but i think you'd need more 
than 5000 to start seeing a difference. besides, python saves the 
compiled modules as .PYC files, so files are only compiled once.


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org