[Zope3-dev] PythonProgrammerTutorial

Martijn Faassen faassen@vet.uu.nl
Thu, 6 Dec 2001 22:37:09 +0100


Jim Fulton wrote:
> > Both these would avoid object creation, which is
> > slow in Python.
> 
> I wonder about that. 

Well, perhaps the object creation bit itself isn't that terrible, but
in case of simple proxy wrapping (such as in ParsedXML) there are two
extra lookups per method call (first to lookup the proxy's version of
the method, and then to look up the attribute pointing to the real
object, and finally we do call the real method). I think that has an
impact as well.

We should try some more benchmarking, but it's something I'm slightly
concerned about.   

> > Alternatively we could advocate faster object creation in Python. See the
> > 'object allocation' entry in this Python versus Java comparison for
> > some data on that:
> > 
> > http://www.twistedmatrix.com/users/glyph/rant/python-vs-java.html
> 
> It's not clear how to interpret this. It looks to me like
> object creation is fast in both Python and Java, but Java is faster.
> The numbers for object creation are the lowest and repetition is the
> highest, 10 million.

Well, perhaps it isn't a big deal. They're definitely just simple tests.
  
> > but I expect improving this isn't considered to be easy as otherwise
> > it'd have been done already.
> 
> Or maybe nobody complained?
> 
> I'm sure there's more that can be done of there is a problem.

Naturally; just putting this potential problem on the list of things to
take into consideration.

Regards,

Martijn