[XML-SIG] foo.bar vs. foo.get_bar()

Carey Evans c.evans@clear.net.nz
06 Nov 1999 13:33:59 +1300


uche.ogbuji@fourthought.com writes:

> So the list of knocks against "node.parent" is now:
> 
> *	Probably slower

Has anyone tried this?  PyDOM includes __getattr__ and __setattr__,
but doesn't actually use them.  As a simple test, I ran a small
program that parses a 30K XML file into a DOM tree (as in the
xml-howto), then prints it out (using the dump method), using PyDOM.

With __get/setattr__ the average runtime was 9.1 seconds.  With those
methods commented out, the average runtime was 4.1 seconds, so it was
more than twice as fast.  I wonder how much slower it would be if the
methods were ever actually used?

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	       "This is where your sanity gives in..."