changeset 50678:11562d72cb7b

store: directly pass the filesize in the `details` of revlog The dictionary only contains 1 (or 0) entries, we can directly store that information (or None). Moving to a simpler argument passing result in a noticable speedup (because Python) The number below use `hg perf::stream-locked-section` to measure the time spend in the locked section of the streaming clone. Number are run on various repository. ### mercurial-2018-08-01-zstd-sparse-revlog before: 0.031247 seconds after: 0.030246 seconds (-3.20%) ### mozilla-central-2018-08-01-zstd-sparse-revlog before: 6.718968 seconds after: 6.304179 seconds (-6.17%) ### mozilla-try-2019-02-18-zstd-sparse-revlog before: 14.631343 seconds after: 14.142687 seconds (-3.34%) ### netbeans-2018-08-01-zstd-sparse-revlog before: 2.895584 seconds after: 2.719939 seconds (-6.07%) ### pypy-2018-08-01-zstd-sparse-revlog before: 0.561843 seconds after: 0.543034 seconds (-3.35%)
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 30 May 2023 16:38:13 +0100
parents cdb471c8ebcf
children e06d1a779eb6
files mercurial/store.py
diffstat 1 files changed, 7 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/store.py	Tue May 30 16:35:10 2023 +0100
+++ b/mercurial/store.py	Tue May 30 16:38:13 2023 +0100
@@ -607,14 +607,13 @@
             self._files = []
             for ext in sorted(self._details, key=_ext_key):
                 path = self._path_prefix + ext
-                data = self._details[ext]
+                file_size = self._details[ext]
                 # files that are "volatile" and might change between
                 # listing and streaming
                 #
                 # note: the ".nd" file are nodemap data and won't "change"
                 # but they might be deleted.
                 volatile = ext.endswith(REVLOG_FILES_VOLATILE_EXT)
-                file_size = data.get('file_size')
                 f = StoreFile(path, file_size, volatile)
                 self._files.append(f)
         return self._files
@@ -802,10 +801,8 @@
                 if strip_filename and b'/' in revlog:
                     revlog_target_id = revlog_target_id.rsplit(b'/', 1)[0]
                     revlog_target_id += b'/'
-                for ext, (t, s) in sorted(details.items()):
-                    file_details[ext] = {
-                        'file_size': s,
-                    }
+                for ext, (t, size) in sorted(details.items()):
+                    file_details[ext] = size
                 yield RevlogStoreEntry(
                     path_prefix=revlog,
                     revlog_type=rl_type,
@@ -857,10 +854,8 @@
         for data, revlog_type in top_rl:
             for revlog, details in sorted(data.items()):
                 file_details = {}
-                for ext, (t, s) in details.items():
-                    file_details[ext] = {
-                        'file_size': s,
-                    }
+                for ext, (t, size) in details.items():
+                    file_details[ext] = size
                 yield RevlogStoreEntry(
                     path_prefix=revlog,
                     revlog_type=revlog_type,
@@ -1160,8 +1155,8 @@
             else:
                 # unreachable
                 assert False, revlog
-            for ext, t in details.items():
-                file_details[ext] = {}
+            for ext in details:
+                file_details[ext] = None
             entry = RevlogStoreEntry(
                 path_prefix=revlog,
                 revlog_type=rl_type,