##// END OF EJS Templates
commit: increase perf by building a new addlist instead of editing the old one...
Durham Goode -
r17983:c64e646a default
parent child Browse files
Show More
@@ -117,15 +117,23 b' class manifest(revlog.revlog):'
117 117 # apply the changes collected during the bisect loop to our addlist
118 118 # return a delta suitable for addrevision
119 119 def addlistdelta(addlist, x):
120 # start from the bottom up
121 # so changes to the offsets don't mess things up.
122 for start, end, content in reversed(x):
120 # for large addlist arrays, building a new array is cheaper
121 # than repeatedly modifying the existing one
122 currentposition = 0
123 newaddlist = array.array('c')
124
125 for start, end, content in x:
126 newaddlist += addlist[currentposition:start]
123 127 if content:
124 addlist[start:end] = array.array('c', content)
125 else:
126 del addlist[start:end]
127 return "".join(struct.pack(">lll", start, end, len(content))
128 newaddlist += array.array('c', content)
129
130 currentposition = end
131
132 newaddlist += addlist[currentposition:]
133
134 deltatext = "".join(struct.pack(">lll", start, end, len(content))
128 135 + content for start, end, content in x)
136 return deltatext, newaddlist
129 137
130 138 def checkforbidden(l):
131 139 for f in l:
@@ -194,7 +202,8 b' class manifest(revlog.revlog):'
194 202 if dstart is not None:
195 203 delta.append([dstart, dend, "".join(dline)])
196 204 # apply the delta to the addlist, and get a delta for addrevision
197 cachedelta = (self.rev(p1), addlistdelta(addlist, delta))
205 deltatext, addlist = addlistdelta(addlist, delta)
206 cachedelta = (self.rev(p1), deltatext)
198 207 arraytext = addlist
199 208 text = util.buffer(arraytext)
200 209
General Comments 0
You need to be logged in to leave comments. Login now