[Zope-CVS] CVS: Products/ZCTextIndex - Lexicon.py:1.1.2.11

Jeremy Hylton jeremy@zope.com
Tue, 14 May 2002 01:00:31 -0400


Update of /cvs-repository/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv13478

Modified Files:
      Tag: TextIndexDS9-branch
	Lexicon.py 
Log Message:
Replace a for loop with a map. 
 
Profiling suggests that this is a crucial hotspot in the indexing process, 
as the for loop iterates over every word in every document.  The change 
is so simple it doesn't even feel premature. 
 
map has got to be a win if only because of the number of SET_LINENOs  
avoided. 


=== Products/ZCTextIndex/Lexicon.py 1.1.2.10 => 1.1.2.11 ===
         for element in self.__pipeline:
             last = element.process(last)
-        wids = []
-        for word in last:
-            wids.append(self._getWordIdCreate(word))
-        return wids
+        return map(self._getWordIdCreate, last)
 
     def termToWordIds(self, text):
         last = _text2list(text)