Re: Unique string storage

Tim Peters (
Wed, 06 Apr 94 23:12:25 -0400

> > > [jim]
> > > [tim writes, after noting that strcmp is typically inline expanded]

I wouldn't say that inlining strcmp is typical.

> > > [tim]
> > > 2) Profiling is a useless approach for guessing how much time is
> > > spent on "attribute access" ...

> > [mark]
> > Good point; timings from a set of typical programs would be better.

> [jim]
> Sorry, but I don't agree. You just have to be clever when you do the
> profiling. [explaining that strcmp can be accounted for by renaming
> it, even if it is inlined]

Sure, but the piece you quoted above wasn't talking about strcmp! strcmp
is of varying importance to the various attribute-access techniques
Python uses, and Python uses strcmp for things other than attribute
access too. So finding out where strcmp fits in a profile doesn't tell
us how much time is spent on attribute access: the latter comprises much
more than strcmp time, and not all strcmp time counts as attribute access
time. Pieces of attribute access are done in _many_ places in the code,
and the routines called from those places are also called for other

You might get _some_ non-absurd starting point from combining profile
stats for the ~60 different XXX_getattr/XXX_setattr routines, though.

Placing strcmp would only settle the bet Don & I have going about strcmp
itself <avaricious grin>. I'll grant that if strcmp is a heavy hitter in
a "typical program" that isn't crunching many user-defined string
objects, then Don's probably right (i.e., both that strcmp accounts for
lots of Python's runtime, & that this is so specifically because of its
current role in attribute access).

true-meaning-of-"typical"<wink>-ly y'rs - tim

Tim Peters
not speaking for Kendall Square Research Corp