Skip to content
Snippets Groups Projects
Commit eafa06e9edde authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

treemanifest: speed up commit using dirty flag

We currently avoid saving a treemanifest revision if it's the same as
one of it's parents. This is checked by comparing the generated text
for all three versions. Let's avoid that when possible by comparing
the nodeids for clean (not dirty) nodes.

On the Mozilla repo, this speeds up commit from 2.836s to 2.343s.
parent f0fbd88b21fb
No related branches found
No related tags found
No related merge requests found
......@@ -759,6 +759,9 @@
_diff(self, m2)
return result
def unmodifiedsince(self, m2):
return not self._dirty and not m2._dirty and self._node == m2._node
def parse(self, text, readsubtree):
for f, n, fl in _parse(text):
if fl == 'd':
......@@ -951,8 +954,12 @@
return n
def _addtree(self, m, transaction, link, m1, m2):
# If the manifest is unchanged compared to one parent,
# don't write a new revision
if m.unmodifiedsince(m1) or m.unmodifiedsince(m2):
return m.node()
def writesubtree(subm, subp1, subp2):
sublog = self.dirlog(subm.dir())
sublog.add(subm, transaction, link, subp1, subp2, None, None)
m.writesubtrees(m1, m2, writesubtree)
text = m.dirtext(self._usemanifestv2)
......@@ -954,10 +961,9 @@
def writesubtree(subm, subp1, subp2):
sublog = self.dirlog(subm.dir())
sublog.add(subm, transaction, link, subp1, subp2, None, None)
m.writesubtrees(m1, m2, writesubtree)
text = m.dirtext(self._usemanifestv2)
# If the manifest is unchanged compared to one parent,
# don't write a new revision
# Double-check whether contents are unchanged to one parent
if text == m1.dirtext(self._usemanifestv2):
n = m1.node()
elif text == m2.dirtext(self._usemanifestv2):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment