[Zope-Coders] -O considered useful

Jim Fulton jim@zope.com
Fri, 19 Oct 2001 10:06:14 -0400


The Python -O (optimized) option can often speed up Python 
applications slightly. Applications with lots of assertions 
or other __debug__-dependent code (like ZEO's debug logging) 
can benefit a lot from use of -O.

I've heard that ZEO runs a lot (~20%) faster with -O, due to the 
detailed logging calls it makes that are conditioned on __debug__.
(Note that getting this benefit requires that you have a 
recent zdaemon that passes along the -O switch to sub-processes.)

I'd like to be able to tell people to use -O in production sites
where performance matters.  I even made a change to zdaemon
a while back that makes this affective. ;)

I've heard a rumor that some people have written Zope code
that depends on side affects of assert or __debug__-conditioned
code.  If this is true, it is a bug that needs to be fixed.
We'll check for this, but if you know of any cases like this, 
please fix them if you can, or let us know so we can fix them.

Jim

--
Jim Fulton           mailto:jim@zope.com       Python Powered!        
CTO                  (888) 344-4332            http://www.python.org  
Zope Corporation     http://www.zope.com       http://www.zope.org