print statements and profiling a function slowed performance

Skip Montanaro skip at pobox.com
Fri Jun 27 12:05:37 EDT 2014


On Fri, Jun 27, 2014 at 10:55 AM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> Expectations don't count, measure it :)

It's no contest. I have measured it (ages ago). The logging module
does so many things that it's impossible for it to ever be as fast as
a simple print statement. Look at the code in LogRecord.__init__. Then
note the doc string:

... LogRecord instances are created every time something is logged. ...

Skip



More information about the Python-list mailing list