Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 16665:e410be860393
revlog: speed up prefix matching against nodes
The radix tree already contains all the information we need to
determine whether a short string is an unambiguous node identifier.
We now make use of this information.
In a kernel tree, this improves the performance of
"hg log -q -r24bf01de75" from 0.27 seconds to 0.06.
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Sat, 12 May 2012 10:55:08 +0200 |
parents | 95698ee29181 |
children | 67964cda8701 |
comparison
equal
deleted
inserted
replaced
16664:5bc6edf71b39 | 16665:e410be860393 |
---|---|
754 return node | 754 return node |
755 except (TypeError, LookupError): | 755 except (TypeError, LookupError): |
756 pass | 756 pass |
757 | 757 |
758 def _partialmatch(self, id): | 758 def _partialmatch(self, id): |
759 try: | |
760 return self.index.partialmatch(id) | |
761 except RevlogError: | |
762 # parsers.c radix tree lookup gave multiple matches | |
763 raise LookupError(id, self.indexfile, _("ambiguous identifier")) | |
764 except (AttributeError, ValueError): | |
765 # we are pure python, or key was too short to search radix tree | |
766 pass | |
767 | |
759 if id in self._pcache: | 768 if id in self._pcache: |
760 return self._pcache[id] | 769 return self._pcache[id] |
761 | 770 |
762 if len(id) < 40: | 771 if len(id) < 40: |
763 try: | 772 try: |