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

Gregory Szorc gregory.szorc at gmail.com
Thu Jul 6 14:10:35 EDT 2017


On Mon, Jul 3, 2017 at 12:48 PM, Durham Goode <durham at fb.com> wrote:

> 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)
>

I'll add an inline TODO to capture the issue in v2.

If we have to persist a cache between processes, then this looks a lot like
the .hgtags fnodes cache. We could probably make that code generic and
reuse for storing the sparse profiles fnodes. Of course, I'd like to think
this optimization is no longer needed with tree manifests...


>
> 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.mer
>> curial-2Dscm.org_mailman_listinfo_mercurial-2Ddevel&d=DwIGaQ
>> &c=5VD0RTtNlTh3ycd41b3MUw&r=nuarHzhP1wi1T9iURRCj1A&m=lH6Uvaf
>> Ovi_liZJSPgcLMbPWLGbtL6YbEWEwP9H2yHA&s=rGt5W0GmeKrxsDV2fsJQq
>> 9FK6n5egsTf_oeWPZDaico&e=
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170706/377ec3b7/attachment.html>


More information about the Mercurial-devel mailing list