[XML-SIG] string interning

Lars Marius Garshol larsga@garshol.priv.no
11 Sep 2001 13:33:22 +0200


* Alexandre Fayolle
| 
| What intern() does is look for a string object being equal() to the
| current String

A string object being == to the current String, yes. This is the same
as '==' versus 'is' in Python.

| This can save memory (because fewer objects are produced by the
| parser) and time (because one can use the == operator to test if
| element names are equal (equivalent of python's 'is' test in this
| context).

Exactly.

I think the actual benefit in Python is small, but we kept this
property anyway. I found that xmlproc was a little bit faster when I
called intern() on all names, so I used it.
 
--Lars M.