revset: avoid in loop lookup in _generatorset._consumegen
Python lookups are slow, so do all lookup outside of the for loop.
This provide a small but still significant speedup:
revset #0: 0::
0) wall 0.063258 comb 0.060000 user 0.060000 sys 0.000000 (best of 100)
1) wall 0.057776 comb 0.050000 user 0.050000 sys 0.000000 (best of 100)
--- a/mercurial/revset.py Fri Apr 25 14:51:24 2014 -0700
+++ b/mercurial/revset.py Wed Apr 30 16:56:48 2014 -0700
@@ -2672,9 +2672,11 @@
i += 1
def _consumegen(self):
+ cache = self._cache
+ genlist = self._genlist.append
for item in self._gen:
- self._cache[item] = True
- self._genlist.append(item)
+ cache[item] = True
+ genlist(item)
yield item
self._finished = True