On Tue, Nov 09, 2010 at 03:49:38PM +0100, Charlie Clark wrote:
> Am 08.11.2010, 15:35 Uhr, schrieb Brian Sutherland  
> <br...@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)

In response to Marius' comments I changed the patch a bit earlier to
this:

    def queryTaggedValue(self, tag, default=None):
        """ Returns the value associated with 'tag'. """
        tv = self.__tagged_values
        if tv is None:
            return default
        return tv.get(tag, default)

Which is is faster as well as not doing the explicit name mangling you
object to.
 
> Any improvements higher up the stack (using slots, different Python  
> version or compilers like LLVM) are likely to have a more significant  
> effect.

That would be great, when it arrives.

Actually, in my case, memory is the issue. So the only optimization
that'll really help in a big way is if multiple python processes running
similar code start sharing data.

Some people have poked at that problem, but I havn't seen anything
significant yet.

> Might be worth timing a slots-based implementation.

I just tried to add slots to Element, Attribute and Method classes, but
it there's too many tests that break to benchmark it running the ZTK
tests.

On the micro benchmarks, the only difference I see is a memory
improvement which I think will not survive in practice because most 

> 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
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> https://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  https://mail.zope.org/mailman/listinfo/zope-announce
>  https://mail.zope.org/mailman/listinfo/zope )

-- 
Brian Sutherland
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to