[Zope-dev] zope.interface memory optimization

Charlie Clark charlie.clark at clark-consulting.eu
Tue Nov 9 09:49:38 EST 2010


Am 08.11.2010, 15:35 Uhr, schrieb Brian Sutherland  
<brian at vanguardistas.net>:

> If no-one replies, I'll assume that 3% is just not enough to be
> interesting and do nothing;)

Hi Brian,

thanks for sharing this but it looks to me like a micro-optimisation that  
isn't really worth going against best practice for - by using explicit  
name-mangling.

-        return self.__tagged_values.get(tag, default)
+        return getattr(self, '_Element__tagged_values', {}).get(tag,  
default)

Any improvements higher up the stack (using slots, different Python  
version or compilers like LLVM) are likely to have a more significant  
effect. Might be worth timing a slots-based implementation.

Charlie
-- 
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226


More information about the Zope-Dev mailing list