[Zope-dev] Small fix in Products.ZCTextIndex, how to go further?
Charlie Clark
charlie.clark at clark-consulting.eu
Wed Nov 14 15:40:07 UTC 2012
Am 14.11.2012, 16:26 Uhr, schrieb Hanno Schlichting <hanno at hannosch.eu>:
> Hi.
> The change looks ok. But I think you broke an optimization. IIRC the code
> compares the old and new values for the index, and skips the indexing
> step
> if they are the same. The typical item.reindexObject() call sents data
> for
> all indexes, even if just one or two them have changed. The optimization
> made sure to skip any extra work, if there wasn't really any change for
> the
> text index. Without that check, you end up updating and writing a bunch
> of
> internal data structures in the text index every time. Those lead to
> slower
> write performance and more conflict errors.
> Could you have another look, and see if you can preserve the
> optimization?
Could we also have a clean up with a specific exception in the try:
except: clause? I assume we're expecting an AttributeError?
And move filter to a generator expression / list comprehension? I could
say for Python 3 compatibility but that doesn't matter so much as there is
no easy way for the isinstance(t, basestring)
Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
More information about the Zope-Dev
mailing list