[PATCH 04 of 13 sparse] sparse: remove reference to simplecache

Durham Goode durham at fb.com
Mon Jul 3 15:48:18 EDT 2017


On 7/1/17 6:55 PM, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1498932351 25200
> #      Sat Jul 01 11:05:51 2017 -0700
> # Node ID f2b0d199751ba38008bc1862b95b8f6ecbb0d7be
> # Parent  3c260103478c787f8c3e0915575fb94ebee5b89d
> sparse: remove reference to simplecache
>
> This is a 3rd party extension authored by Facebook. References in
> core are not appropriate.
>
> It will be possible to restore this code/optimization via
> monkeypatching. So Facebook won't lose any functionality.


While I'm fine with this being removed for now, the memoization below is 
pretty important for performance.  Basically, any time a profile needs 
to be read it has to read the manifest. So for any repo with a manifest 
large enough to cause perf issues, this shifts some manifest read times 
into commands that previously might not have had to parse manifests 
(like hg status maybe? I forget the specific areas this code is hit)

> diff --git a/hgext/sparse.py b/hgext/sparse.py
> --- a/hgext/sparse.py
> +++ b/hgext/sparse.py
> @@ -436,16 +436,7 @@ def _wraprepo(ui, repo):
>              return includes, excludes, profiles
>
>          def getrawprofile(self, profile, changeid):
> -            try:
> -                simplecache = extensions.find('simplecache')
> -                node = self[changeid].hex()
> -                def func():
> -                    return self.filectx(profile, changeid=changeid).data()
> -                key = 'sparseprofile:%s:%s' % (profile.replace('/', '__'), node)
> -                return simplecache.memoize(func, key,
> -                        simplecache.stringserializer, self.ui)
> -            except KeyError:
> -                return self.filectx(profile, changeid=changeid).data()
> +            return self.filectx(profile, changeid=changeid).data()
>
>          def sparsechecksum(self, filepath):
>              fh = open(filepath)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-2Dscm.org_mailman_listinfo_mercurial-2Ddevel&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=nuarHzhP1wi1T9iURRCj1A&m=lH6UvafOvi_liZJSPgcLMbPWLGbtL6YbEWEwP9H2yHA&s=rGt5W0GmeKrxsDV2fsJQq9FK6n5egsTf_oeWPZDaico&e=
>


More information about the Mercurial-devel mailing list