[XML-SIG] SAX 2.0 names

Greg Stein gstein@lyra.org
Tue, 29 Feb 2000 13:34:47 -0800 (PST)

I'm all for using tuples. If somebody wants extended capabilities through
the use of objects, then they can use them on top of tuples. If you start
with objects, then you've set a minimum. As Thomas said, using tuples is
simple, clean, and Pythonic.


On 29 Feb 2000, Lars Marius Garshol wrote:
> I did the benchmark I spoke of, and the results indicate that the
> performance differences are very small between strings and tuples.
> Also, how you put together the strings influences the speed a
> bit. Benchmark run with Python 1.5.2 on Debian GNU/Linux on a Pentium
> II with plenty of RAM and MHz.
> [larsga@pc-larsga python]$ python sax2bench.py 
> Pure parsing time: 28.73
> ---Generic:
> __main__.NamespaceFilterString  30.25
> __main__.NamespaceFilterInternedString  30.85
>  __main__.NamespaceFilterTuple  30.15
> ---Specific:
> __main__.NamespaceFilterString  30.71
> __main__.NamespaceFilterInternedString  30.7
>  __main__.NamespaceFilterTuple  29.67

The reason they seem small is because the "benchmark" is bogus. You have a
HUGE constant factor. Just look at the thing: hundreds of lines. Classes
here and there, function calls over that way, etc.

If you want to truly benchmark the varieties, then initialize a number of
sample objects and time their *usage*. Alternatively, you can time their
*construction* from some fake data.

As it is, your test has *way* too much noise in it to provide adequate
information about the performance of the alternatives.

And besides... performance isn't everything. The use of tuples is clean
and straight-forward. That counts for quite a lot. The fact that it
appears they are more efficient (based on your rough test) is just another
wonderful boon for them.


Greg Stein, http://www.lyra.org/