Am 10.11.2010, 01:40 Uhr, schrieb Brian Sutherland  

>> > On the micro benchmarks, the only difference I see is a memory
>> > improvement which I think will not survive in practice because most
>> ... ?
> Er, somehow my thoughts didn't make it into text:
> attributes are zope.schema fields (i.e. subclasses of Attribute).
> To really make that work, you'd have to add __slots__ to most of the
> classes in zope.schema as well.

It might be purely academic but if this does significantly reduce memory  
use then it might be worth pursuing. Slots are supposed to be beneficial  
when you've got lots of objects around. Zope schema fields are pretty  
static anyway so I don't see a great penalty in having to add slots to  
them, although obviously a migration of a larger project would probably be  
a pain.

Back to the micro-optimisation. At Jeff Rush's talk at PyCon this year he  
covered the penalties incurred by "." lookups so that might be something  
that could be investigated but might it also be possible to "memoize" the  
method calls? I keep forgetting when you can't do that.

Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
Zope-Dev maillist  -
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to