[Tutor] Affect of doc strings on performance

Kent Johnson kent37 at tds.net
Wed Jun 7 11:48:34 CEST 2006

i don't think it makes any difference. I suppose it will slow down the 
parsing of the file by a tiny amount, and increase memory usage by the 
size of the strings, but I don't think it will change execution time.

The Python standard library has lots of doc strings. Type help(dict) at 
the interpreter prompt for an example. The dict class is highly 
optimized so if doc strings affected speed that would be a problem.

If you have a time critical function, you could always time it with and 
without doc strings to be sure! In Python it's always best to answer 
"which is faster" questions with real data.


Akanksha Govil wrote:
> Hi,
> I wanted to know if we give large doc strings in the python scripts, 
> does it slow down the script execution?
> Should we always keep those doc strings to minimum if we want fast 
> script execution?
> Thanks
> Akanksha
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> ------------------------------------------------------------------------
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list