comparison mercurial/revlog.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 e69274f8d444
children e1b9a78a7aed
comparison
equal deleted inserted replaced
17949:407209261f63 17951:6f79c32c0bdf
252 def tip(self): 252 def tip(self):
253 return self.node(len(self.index) - 2) 253 return self.node(len(self.index) - 2)
254 def __len__(self): 254 def __len__(self):
255 return len(self.index) - 1 255 return len(self.index) - 1
256 def __iter__(self): 256 def __iter__(self):
257 for i in xrange(len(self)): 257 return iter(xrange(len(self)))
258 yield i
259 def revs(self, start=0, stop=None): 258 def revs(self, start=0, stop=None):
260 """iterate over all rev in this revlog (from start to stop)""" 259 """iterate over all rev in this revlog (from start to stop)"""
261 if stop is None: 260 if stop is None:
262 stop = len(self) 261 stop = len(self)
263 else: 262 else: