Rev 2995: (robertc) Use the GraphIndex header to answer key_count queries rather than parsing the entire index unnecessarily. (Robert Collins) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Nov 14 19:13:52 GMT 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2995
revision-id: pqm at pqm.ubuntu.com-20071114191349-wkdpsuhhbogisob8
parent: pqm at pqm.ubuntu.com-20071114182425-x73jp620qoazf94g
parent: robertc at robertcollins.net-20071112234354-suyfvrs72rogqw2f
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2007-11-14 19:13:49 +0000
message:
(robertc) Use the GraphIndex header to answer key_count queries rather than parsing the entire index unnecessarily. (Robert Collins)
modified:
bzrlib/index.py index.py-20070712131115-lolkarso50vjr64s-1
------------------------------------------------------------
revno: 2979.1.1
merged: robertc at robertcollins.net-20071112234354-suyfvrs72rogqw2f
parent: pqm at pqm.ubuntu.com-20071112195430-0xgqswqpc1j2pk2m
committer: Robert Collins <robertc at robertcollins.net>
branch nick: index
timestamp: Tue 2007-11-13 10:43:54 +1100
message:
Use the GraphIndex header to answer key_count queries rather than parsing the entire index unnecessarily.
=== modified file 'bzrlib/index.py'
--- a/bzrlib/index.py 2007-10-18 01:17:01 +0000
+++ b/bzrlib/index.py 2007-11-12 23:43:54 +0000
@@ -36,6 +36,7 @@
""")
from bzrlib import debug, errors
+_HEADER_READV = (0, 200)
_OPTION_KEY_ELEMENTS = "key_elements="
_OPTION_LEN = "len="
_OPTION_NODE_REFS = "node_ref_lists="
@@ -555,8 +556,7 @@
For GraphIndex the estimate is exact.
"""
if self._key_count is None:
- # really this should just read the prefix
- self._buffer_all()
+ self._read_and_parse([_HEADER_READV])
return self._key_count
def _lookup_keys_via_location(self, location_keys):
@@ -612,7 +612,7 @@
readv_ranges.append((location, length))
# read the header if needed
if self._bisect_nodes is None:
- readv_ranges.append((0, 200))
+ readv_ranges.append(_HEADER_READV)
self._read_and_parse(readv_ranges)
# generate results:
# - figure out <, >, missing, present
More information about the bazaar-commits
mailing list