[PATCH] largefiles: improve status performance
Levi Bard
taktaktaktaktaktaktaktaktaktak at gmail.com
Sun Jun 24 07:27:20 CDT 2012
# HG changeset patch
# User Levi Bard <levi at unity3d.com>
# Date 1340540784 -7200
# Node ID ffc9863d33de86841aa0d93364fa071854d04ae5
# Parent efd2e14f72353626355dc82465bdf23bf6416aa2
largefiles: improve status performance
Synchronize largefiles' mtimes when updating them.
This greatly reduces the amount of superfluous largefile hashing status does.
Benchmarked on a 1GB repo with 54000 normal files and 113 largefiles:
Without largefiles: 600ms
With largefiles - before: 2500ms
With largefiles - after: 700ms
diff -r efd2e14f7235 -r ffc9863d33de hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py Thu Jun 21 17:37:02 2012 -0500
+++ b/hgext/largefiles/lfcommands.py Sun Jun 24 14:26:24 2012 +0200
@@ -479,6 +479,16 @@
# recognition that such cache missing files are REMOVED.
lfdirstate.normallookup(lfile)
return None # don't try to set the mode
+ else:
+ try:
+ # Synchronize largefile's last modified time
+ # with dirstate
+ state, mode, size, time = lfdirstate.dmap(lfile)
+ if -1 != time:
+ # Don't force-synchronize -1 "dirty" mtime
+ os.utime(abslfile, (-1, time))
+ except KeyError:
+ pass
ret = 1
mode = os.stat(absstandin).st_mode
if mode != os.stat(abslfile).st_mode:
diff -r efd2e14f7235 -r ffc9863d33de hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py Thu Jun 21 17:37:02 2012 -0500
+++ b/hgext/largefiles/lfutil.py Sun Jun 24 14:26:24 2012 +0200
@@ -140,6 +140,8 @@
return super(largefilesdirstate, self).forget(unixpath(f))
def normallookup(self, f):
return super(largefilesdirstate, self).normallookup(unixpath(f))
+ def dmap(self, f):
+ return self._map[f]
def openlfdirstate(ui, repo):
'''
More information about the Mercurial-devel
mailing list