Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 16786:2631cd5dd244
revlog: switch to a C version of headrevs
The C implementation is more than 100 times faster than the Python
version (which is still available as a fallback).
In a repo with 330,000 revs and a stale .hg/cache/tags file, this
patch improves the performance of "hg tip" from 2.2 to 1.6 seconds.
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Sat, 19 May 2012 19:44:58 -0700 |
parents | 93f8b9565257 |
children | 107a3270a24a |
comparison
equal
deleted
inserted
replaced
16785:1dc08dc63c09 | 16786:2631cd5dd244 |
---|---|
633 assert roots | 633 assert roots |
634 assert heads | 634 assert heads |
635 return (orderedout, roots, heads) | 635 return (orderedout, roots, heads) |
636 | 636 |
637 def headrevs(self): | 637 def headrevs(self): |
638 try: | |
639 return self.index.headrevs() | |
640 except AttributeError: | |
641 pass | |
638 count = len(self) | 642 count = len(self) |
639 if not count: | 643 if not count: |
640 return [nullrev] | 644 return [nullrev] |
641 ishead = [1] * (count + 1) | 645 ishead = [1] * (count + 1) |
642 index = self.index | 646 index = self.index |