[XML-SIG] Re: Re: Re: cElementTree 0.8 (january 11, 2005)
Daniel Veillard
veillard at redhat.com
Fri Jan 14 12:00:41 CET 2005
On Fri, Jan 14, 2005 at 11:43:04AM +0100, Fredrik Lundh wrote:
> Daniel Veillard wrote:
>
> > Seriously, with respect to performances one of the trouble I have seen when
> > doing a bit of profiling is that interning strings, i.e. the process of
> > taking string coming from C and turning them into Python string objects,
> > to be extremely costly, I don't know if it's the hash function or the way
> > the string hash works but it was one of the biggest cost when I tried
> > (with python 2.3 or 2.2 I can't remember precisely when it was).
>
> in python, conversion and interning and hash calculations are three different
> things, so I'm not sure what your problem really was. but I'm curious. can
> you elaborate?
You have a python function calling a native function. That function returns
a string. That C string is translated to a Python string by the wrapper
using PyString_FromString(). That operation seems to be extremely expensive.
Daniel
--
Daniel Veillard | Red Hat Desktop team http://redhat.com/
veillard at redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
More information about the XML-SIG
mailing list