changeset 51284:58d39c7865e5

usage: configure uncompressed chunk cache through resource configuration Let's use this new concept for what it is meant for. This provides a sizable speed up for reading multiple revision for some complexe repositories. ### data-env-vars.name = pypy-2018-08-01-zstd-sparse-revlog # benchmark.name = hg.perf.read-revisions # benchmark.variants.order = reverse memory-medium: 1.892400 memory-high: 1.722934 (-8.61%) # benchmark.variants.order = default memory-medium: 1.751542 memory-high: 1.589340 (-9.49%)
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 08 Nov 2023 01:58:16 +0100
parents 83c6dceeb10d
children 9d3721552b6c
files mercurial/configitems.toml mercurial/localrepo.py
diffstat 2 files changed, 13 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/configitems.toml	Mon Oct 09 15:12:16 2023 +0200
+++ b/mercurial/configitems.toml	Wed Nov 08 01:58:16 2023 +0100
@@ -1111,28 +1111,6 @@
 
 [[items]]
 section = "experimental"
-name = "revlog.uncompressed-cache.enabled"
-default = true
-experimental = true
-documentation = """Enable some caching of uncompressed chunk, greatly boosting
-performance at the cost of memory usage."""
-
-[[items]]
-section = "experimental"
-name = "revlog.uncompressed-cache.factor"
-default = 4
-experimental = true
-documentation = """The size of the cache compared to the largest revision seen."""
-
-[[items]]
-section = "experimental"
-name = "revlog.uncompressed-cache.count"
-default = 10000
-experimental = true
-documentation = """The number of chunk cached."""
-
-[[items]]
-section = "experimental"
 name = "stream-v3"
 default = false
 
--- a/mercurial/localrepo.py	Mon Oct 09 15:12:16 2023 +0200
+++ b/mercurial/localrepo.py	Wed Nov 08 01:58:16 2023 +0100
@@ -369,7 +369,7 @@
         common=None,
         bundlecaps=None,
         remote_sidedata=None,
-        **kwargs
+        **kwargs,
     ):
         chunks = exchange.getbundlechunks(
             self._repo,
@@ -378,7 +378,7 @@
             common=common,
             bundlecaps=bundlecaps,
             remote_sidedata=remote_sidedata,
-            **kwargs
+            **kwargs,
         )[1]
         cb = util.chunkbuffer(chunks)
 
@@ -1089,15 +1089,12 @@
     if chunkcachesize is not None:
         data_config.chunk_cache_size = chunkcachesize
 
-    if ui.configbool(b'experimental', b'revlog.uncompressed-cache.enabled'):
-        factor = ui.configint(
-            b'experimental', b'revlog.uncompressed-cache.factor'
-        )
-        count = ui.configint(
-            b'experimental', b'revlog.uncompressed-cache.count'
-        )
-        data_config.uncompressed_cache_factor = factor
-        data_config.uncompressed_cache_count = count
+    memory_profile = scmutil.get_resource_profile(ui, b'memory')
+    if memory_profile >= scmutil.RESOURCE_MEDIUM:
+        data_config.uncompressed_cache_count = 10_000
+        data_config.uncompressed_cache_factor = 4
+        if memory_profile >= scmutil.RESOURCE_HIGH:
+            data_config.uncompressed_cache_factor = 10
 
     delta_config.delta_both_parents = ui.configbool(
         b'storage', b'revlog.optimize-delta-parent-choice'
@@ -2401,7 +2398,7 @@
         data: bytes,
         flags: bytes,
         backgroundclose=False,
-        **kwargs
+        **kwargs,
     ) -> int:
         """write ``data`` into ``filename`` in the working directory
 
@@ -2584,7 +2581,7 @@
                     repo.hook(
                         b'pretxnclose-bookmark',
                         throw=True,
-                        **pycompat.strkwargs(args)
+                        **pycompat.strkwargs(args),
                     )
             if hook.hashook(repo.ui, b'pretxnclose-phase'):
                 cl = repo.unfiltered().changelog
@@ -2596,7 +2593,7 @@
                         repo.hook(
                             b'pretxnclose-phase',
                             throw=True,
-                            **pycompat.strkwargs(args)
+                            **pycompat.strkwargs(args),
                         )
 
             repo.hook(
@@ -2671,7 +2668,7 @@
                         repo.hook(
                             b'txnclose-bookmark',
                             throw=False,
-                            **pycompat.strkwargs(args)
+                            **pycompat.strkwargs(args),
                         )
 
                 if hook.hashook(repo.ui, b'txnclose-phase'):
@@ -2687,7 +2684,7 @@
                             repo.hook(
                                 b'txnclose-phase',
                                 throw=False,
-                                **pycompat.strkwargs(args)
+                                **pycompat.strkwargs(args),
                             )
 
                 repo.hook(