##// END OF EJS Templates
Make lazyindex load slightly faster
mpm@selenic.com -
r115:39b438ee default
parent child Browse files
Show More
@@ -77,12 +77,11 b' class lazyindex:'
77 self.p = parser
77 self.p = parser
78 def __len__(self):
78 def __len__(self):
79 return len(self.p.index)
79 return len(self.p.index)
80 def load(self, pos):
81 self.p.load(pos)
82 return self.p.index[pos]
80 def __getitem__(self, pos):
83 def __getitem__(self, pos):
81 i = self.p.index[pos]
84 return self.p.index[pos] or self.load(pos)
82 if not i:
83 self.p.load(pos)
84 return self.p.index[pos]
85 return i
86 def append(self, e):
85 def append(self, e):
87 self.p.index.append(e)
86 self.p.index.append(e)
88
87
General Comments 0
You need to be logged in to leave comments. Login now