##// END OF EJS Templates
revset: rely on built in iterator when possible in _generatorset.__iter__...
Pierre-Yves David -
r22670:44dce874 default
parent child Browse files
Show More
@@ -2655,9 +2655,7 b' class _generatorset(object):'
2655
2655
2656 def __iter__(self):
2656 def __iter__(self):
2657 if self._finished:
2657 if self._finished:
2658 for x in self._genlist:
2658 return iter(self._genlist)
2659 yield x
2660 return
2661
2659
2662 # We have to use this complex iteration strategy to allow multiple
2660 # We have to use this complex iteration strategy to allow multiple
2663 # iterations at the same time. We need to be able to catch revision
2661 # iterations at the same time. We need to be able to catch revision
@@ -2665,16 +2663,18 b' class _generatorset(object):'
2665 #
2663 #
2666 # Getting rid of it would provide an about 15% speed up on this
2664 # Getting rid of it would provide an about 15% speed up on this
2667 # iteration.
2665 # iteration.
2668 i = 0
2669 genlist = self._genlist
2666 genlist = self._genlist
2670 nextrev = self._consumegen().next
2667 nextrev = self._consumegen().next
2671 _len = len # cache global lookup
2668 _len = len # cache global lookup
2672 while True:
2669 def gen():
2673 if i < _len(genlist):
2670 i = 0
2674 yield genlist[i]
2671 while True:
2675 else:
2672 if i < _len(genlist):
2676 yield nextrev()
2673 yield genlist[i]
2677 i += 1
2674 else:
2675 yield nextrev()
2676 i += 1
2677 return gen()
2678
2678
2679 def _consumegen(self):
2679 def _consumegen(self):
2680 cache = self._cache
2680 cache = self._cache
General Comments 0
You need to be logged in to leave comments. Login now