[PATCH] largefiles: optimize performance when updating (issue3440)
Na'Tosha Bard
natosha at unity3d.com
Sat May 12 08:55:41 CDT 2012
2012/5/12 Na'Tosha Bard <natosha at unity3d.com>
> # HG changeset patch
> # User Na'Tosha Bard <natosha at unity3d.com>
> # Date 1336830087 -7200
> # Node ID 418599662b77bae8d92e38c98f627d1af8e1f638
> # Parent b496a35f805990dfc5502cdae52b52096a56df7c
> largefiles: optimize performance when updating (issue3440)
>
So seemingly the *real* issue 3440 got eaten in the migration to Bugzilla.
So I guess it's best to remove the issue number from the commit message.
> Previously, when updating, cachelfiles was called blindly on all largefiles
> in the repository at the revision being updated to, despite the fact that
> a list of which largefiles needs to be updated has already been collected.
> This
> optimization constrains the cachelfiles call to only the largefiles that
> need
> to be updated.
>
> On a repository with about 80 largefiles, updating between two revisions
> that
> only change one largefile goes from approximately 6.7 seconds to 3.3
> seconds.
>
> diff -r b496a35f8059 -r 418599662b77 hgext/largefiles/lfcommands.py
> --- a/hgext/largefiles/lfcommands.py Sat May 12 11:45:22 2012 +0200
> +++ b/hgext/largefiles/lfcommands.py Sat May 12 15:41:27 2012 +0200
> @@ -365,7 +365,7 @@
> store = basestore._openstore(repo)
> return store.verify(revs, contents=contents)
>
> -def cachelfiles(ui, repo, node):
> +def cachelfiles(ui, repo, node, filelist=None):
> '''cachelfiles ensures that all largefiles needed by the specified
> revision
> are present in the repository's largefile cache.
>
> @@ -373,6 +373,8 @@
> by this operation; missing is the list of files that were needed but
> could
> not be found.'''
> lfiles = lfutil.listlfiles(repo, node)
> + if filelist:
> + lfiles = set(lfiles) & set(filelist)
> toget = []
>
> for lfile in lfiles:
> @@ -431,7 +433,7 @@
> if printmessage and lfiles:
> ui.status(_('getting changed largefiles\n'))
> printed = True
> - cachelfiles(ui, repo, '.')
> + cachelfiles(ui, repo, '.', lfiles)
>
> updated, removed = 0, 0
> for i in map(lambda f: _updatelfile(repo, lfdirstate, f), lfiles):
>
--
*Na'Tosha Bard*
Build & Infrastructure Developer | Unity Technologies - Copenhagen
*E-Mail:* natosha at unity3d.com
*Skype:* natosha.bard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120512/2d103219/attachment.html>
More information about the Mercurial-devel
mailing list