# HG changeset patch # User Pierre-Yves David # Date 1720450947 -7200 # Node ID c10fa6388dbfff79677e25821d42ab6f6b9a6890 # Parent 522b4d729e89edc76544fa549ed36de4aea0b7fb revlog: use an explicit config option to enable mmap usage for index We replace the `experimental.mmapindexthreshold` with two options: The `storage.revlog.mmap.index` is a boolean option to enable or disable the feature. The `storage.revlog.mmap.index:size-threshold` is a bytes option that control when we will be using mmap instead of plain reading. diff -r 522b4d729e89 -r c10fa6388dbf mercurial/configitems.toml --- a/mercurial/configitems.toml Thu Apr 11 00:02:07 2024 +0200 +++ b/mercurial/configitems.toml Mon Jul 08 17:02:27 2024 +0200 @@ -987,10 +987,6 @@ [[items]] section = "experimental" -name = "mmapindexthreshold" - -[[items]] -section = "experimental" name = "narrow" default = false @@ -2167,6 +2163,16 @@ [[items]] section = "storage" +name = "revlog.mmap.index" +default = false + +[[items]] +section = "storage" +name = "revlog.mmap.index:size-threshold" +default = "1 MB" + +[[items]] +section = "storage" name = "revlog.optimize-delta-parent-choice" default = true alias = [["format", "aggressivemergedeltas"]] diff -r 522b4d729e89 -r c10fa6388dbf mercurial/helptext/config.txt --- a/mercurial/helptext/config.txt Thu Apr 11 00:02:07 2024 +0200 +++ b/mercurial/helptext/config.txt Mon Jul 08 17:02:27 2024 +0200 @@ -2344,6 +2344,17 @@ you do, consider talking with the mercurial developer community about your repositories. +``revlog.mmap.index`` + Whether to use the Operating System "memory mapping" feature (when + possible) to access the revlog index. This improves performance + and reduces memory pressure. + +.. container:: verbose + + ``revlog.mmap.index:size-threshold`` + + The size of index above which to use the "memory mapping" feature. + ``revlog.optimize-delta-parent-choice`` When storing a merge revision, both parents will be equally considered as a possible delta base. This results in better delta selection and improved diff -r 522b4d729e89 -r c10fa6388dbf mercurial/localrepo.py --- a/mercurial/localrepo.py Thu Apr 11 00:02:07 2024 +0200 +++ b/mercurial/localrepo.py Mon Jul 08 17:02:27 2024 +0200 @@ -1123,9 +1123,11 @@ if 0 <= chainspan: delta_config.max_deltachain_span = chainspan - mmapindexthreshold = ui.configbytes(b'experimental', b'mmapindexthreshold') - if mmapindexthreshold is not None: - data_config.mmap_index_threshold = mmapindexthreshold + if ui.configbool(b'storage', b'revlog.mmap.index'): + data_config.mmap_index_threshold = ui.configbytes( + b'storage', + b'revlog.mmap.index:size-threshold', + ) withsparseread = ui.configbool(b'experimental', b'sparse-read') srdensitythres = float( diff -r 522b4d729e89 -r c10fa6388dbf tests/test-revlog-mmapindex.t --- a/tests/test-revlog-mmapindex.t Thu Apr 11 00:02:07 2024 +0200 +++ b/tests/test-revlog-mmapindex.t Mon Jul 08 17:02:27 2024 +0200 @@ -36,7 +36,9 @@ > EOF mmap index which is now more than 4k long - $ hg log -l 5 -T '{rev}\n' --config experimental.mmapindexthreshold=4k + $ hg log -l 5 -T '{rev}\n' \ + > --config storage.revlog.mmap.index=yes \ + > --config storage.revlog.mmap.index:size-threshold=4k mmapping $TESTTMP/a/.hg/store/00changelog.i (no-pure !) mmapping $TESTTMP/a/.hg/store/00changelog-????????.nd (glob) (rust !) 100 @@ -46,7 +48,9 @@ 96 do not mmap index which is still less than 32k - $ hg log -l 5 -T '{rev}\n' --config experimental.mmapindexthreshold=32k + $ hg log -l 5 -T '{rev}\n' \ + > --config storage.revlog.mmap.index=yes \ + > --config storage.revlog.mmap.index:size-threshold=32k mmapping $TESTTMP/a/.hg/store/00changelog-????????.nd (glob) (rust !) 100 99