[Zope-CMF] cmf zpt_generic/search - sequence_length is very slow
for large collections, len () is much faster.
Florent Guillaume
fg at nuxeo.com
Tue Jan 4 14:46:53 EST 2005
> t1 = float(DateTime())
> container.log_me('initating search for %s %f' % ( str(kw),t1 ) )
> items = ctool.searchResults(kw)
> container.log_me('search took %f' % (float(DateTime()) - t1) )
> batch_obj = Batch(items, 25, b_start, orphan=1)
> container.log_me('batch1 %f' % (float(DateTime()) - t1) )
> #length = batch_obj.sequence_length
> length = len (items)
> ----------------------------------------------------------------
> For my len(items) I get very nice timings:
> 2005-01-03T08:54:15 ERROR(200) log_me initating search for
> {'portal_type': ['Document'], 'SearchableText': ''} 1104738855.015000
> ------
> 2005-01-03T08:54:24 ERROR(200) log_me search took 9.605000
> ---------------------------------------------------------------------------
> Please note, that len(items) took 9.707-9.705=0.002s only. Search itself
> took 9.7s first time, but only about 0.1 s next time(s) (cached).
>
> but for
> length = batch_obj.sequence_length
> one get horrible timings:
>
> 2005-01-03T08:59:15 ERROR(200) log_me initating search for
> {'SearchableText': ''} 1104739155.636000
> ------
> 2005-01-03T08:59:15 ERROR(200) log_me search took 0.103000
The search kw are different, {'portal_type': ['Document'],
'SearchableText': ''} vs {'SearchableText': ''}, you can't deduct
anything from this.
Florent
--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope-CMF
mailing list