Mercurial > hg
comparison mercurial/changelog.py @ 17951:6f79c32c0bdf stable
commit: increase perf by avoiding unnecessary filteredrevs check
When commiting to a repo with lots of history (>400000 changesets)
the filteredrevs check (added with 5c89e7fa5bc2) in changelog.py
takes a bit of time even if the filteredrevs set is empty. Skipping
the check in that case shaves 0.36 seconds off a 2.14 second commit.
A 17% gain.
author | Durham Goode <durham@fb.com> |
---|---|
date | Fri, 16 Nov 2012 15:39:12 -0800 |
parents | 2894d180afa1 |
children | c0c943ef4e55 |
comparison
equal
deleted
inserted
replaced
17949:407209261f63 | 17951:6f79c32c0bdf |
---|---|
132 if i not in self.filteredrevs: | 132 if i not in self.filteredrevs: |
133 return self.node(i) | 133 return self.node(i) |
134 | 134 |
135 def __iter__(self): | 135 def __iter__(self): |
136 """filtered version of revlog.__iter__""" | 136 """filtered version of revlog.__iter__""" |
137 for i in xrange(len(self)): | 137 if len(self.filteredrevs) == 0: |
138 if i not in self.filteredrevs: | 138 return revlog.revlog.__iter__(self) |
139 yield i | 139 |
140 def filterediter(): | |
141 for i in xrange(len(self)): | |
142 if i not in self.filteredrevs: | |
143 yield i | |
144 | |
145 return filterediter() | |
140 | 146 |
141 def revs(self, start=0, stop=None): | 147 def revs(self, start=0, stop=None): |
142 """filtered version of revlog.revs""" | 148 """filtered version of revlog.revs""" |
143 for i in super(changelog, self).revs(start, stop): | 149 for i in super(changelog, self).revs(start, stop): |
144 if i not in self.filteredrevs: | 150 if i not in self.filteredrevs: |