[Zope-CVS] CVS: Products/ZCTextIndex - Index.py:1.1.2.23
Jeremy Hylton
jeremy@zope.com
Fri, 3 May 2002 14:58:09 -0400
Update of /cvs-repository/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv16278
Modified Files:
Tag: TextIndexDS9-branch
Index.py
Log Message:
Add further comment explaining why IIBTrees are a more efficient
in-memory representation than dictionaries.
=== Products/ZCTextIndex/Index.py 1.1.2.22 => 1.1.2.23 ===
# IIBTree with 10 elts, and 10 happens to be 2/3s of 2**4. So
# choose 10 as the cutoff for now.
+
+ # The IIBTree has a smaller in-memory representation than a
+ # dictionary, so pickle size isn't the only consideration when
+ # choosing the threshold. The pickle of a 500-elt dict is 92%
+ # of the size of the same IIBTree, but the dict uses more
+ # space when it is live in memory. An IIBTree stores two C
+ # arrays of ints, one for the keys and one for the values. It
+ # holds upto 120 key-value pairs in a single bucket.
try:
map = self._wordinfo[wid]
except KeyError: