Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 51301: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 | 498017baa34b |
children | 8f2ea3fa50fd |
comparison
equal
deleted
inserted
replaced
51300:83c6dceeb10d | 51301:58d39c7865e5 |
---|---|
367 source, | 367 source, |
368 heads=None, | 368 heads=None, |
369 common=None, | 369 common=None, |
370 bundlecaps=None, | 370 bundlecaps=None, |
371 remote_sidedata=None, | 371 remote_sidedata=None, |
372 **kwargs | 372 **kwargs, |
373 ): | 373 ): |
374 chunks = exchange.getbundlechunks( | 374 chunks = exchange.getbundlechunks( |
375 self._repo, | 375 self._repo, |
376 source, | 376 source, |
377 heads=heads, | 377 heads=heads, |
378 common=common, | 378 common=common, |
379 bundlecaps=bundlecaps, | 379 bundlecaps=bundlecaps, |
380 remote_sidedata=remote_sidedata, | 380 remote_sidedata=remote_sidedata, |
381 **kwargs | 381 **kwargs, |
382 )[1] | 382 )[1] |
383 cb = util.chunkbuffer(chunks) | 383 cb = util.chunkbuffer(chunks) |
384 | 384 |
385 if exchange.bundle2requested(bundlecaps): | 385 if exchange.bundle2requested(bundlecaps): |
386 # When requesting a bundle2, getbundle returns a stream to make the | 386 # When requesting a bundle2, getbundle returns a stream to make the |
1087 # experimental config: format.chunkcachesize | 1087 # experimental config: format.chunkcachesize |
1088 chunkcachesize = ui.configint(b'format', b'chunkcachesize') | 1088 chunkcachesize = ui.configint(b'format', b'chunkcachesize') |
1089 if chunkcachesize is not None: | 1089 if chunkcachesize is not None: |
1090 data_config.chunk_cache_size = chunkcachesize | 1090 data_config.chunk_cache_size = chunkcachesize |
1091 | 1091 |
1092 if ui.configbool(b'experimental', b'revlog.uncompressed-cache.enabled'): | 1092 memory_profile = scmutil.get_resource_profile(ui, b'memory') |
1093 factor = ui.configint( | 1093 if memory_profile >= scmutil.RESOURCE_MEDIUM: |
1094 b'experimental', b'revlog.uncompressed-cache.factor' | 1094 data_config.uncompressed_cache_count = 10_000 |
1095 ) | 1095 data_config.uncompressed_cache_factor = 4 |
1096 count = ui.configint( | 1096 if memory_profile >= scmutil.RESOURCE_HIGH: |
1097 b'experimental', b'revlog.uncompressed-cache.count' | 1097 data_config.uncompressed_cache_factor = 10 |
1098 ) | |
1099 data_config.uncompressed_cache_factor = factor | |
1100 data_config.uncompressed_cache_count = count | |
1101 | 1098 |
1102 delta_config.delta_both_parents = ui.configbool( | 1099 delta_config.delta_both_parents = ui.configbool( |
1103 b'storage', b'revlog.optimize-delta-parent-choice' | 1100 b'storage', b'revlog.optimize-delta-parent-choice' |
1104 ) | 1101 ) |
1105 delta_config.candidate_group_chunk_size = ui.configint( | 1102 delta_config.candidate_group_chunk_size = ui.configint( |
2399 self, | 2396 self, |
2400 filename: bytes, | 2397 filename: bytes, |
2401 data: bytes, | 2398 data: bytes, |
2402 flags: bytes, | 2399 flags: bytes, |
2403 backgroundclose=False, | 2400 backgroundclose=False, |
2404 **kwargs | 2401 **kwargs, |
2405 ) -> int: | 2402 ) -> int: |
2406 """write ``data`` into ``filename`` in the working directory | 2403 """write ``data`` into ``filename`` in the working directory |
2407 | 2404 |
2408 This returns length of written (maybe decoded) data. | 2405 This returns length of written (maybe decoded) data. |
2409 """ | 2406 """ |
2582 args = tr.hookargs.copy() | 2579 args = tr.hookargs.copy() |
2583 args.update(bookmarks.preparehookargs(name, old, new)) | 2580 args.update(bookmarks.preparehookargs(name, old, new)) |
2584 repo.hook( | 2581 repo.hook( |
2585 b'pretxnclose-bookmark', | 2582 b'pretxnclose-bookmark', |
2586 throw=True, | 2583 throw=True, |
2587 **pycompat.strkwargs(args) | 2584 **pycompat.strkwargs(args), |
2588 ) | 2585 ) |
2589 if hook.hashook(repo.ui, b'pretxnclose-phase'): | 2586 if hook.hashook(repo.ui, b'pretxnclose-phase'): |
2590 cl = repo.unfiltered().changelog | 2587 cl = repo.unfiltered().changelog |
2591 for revs, (old, new) in tr.changes[b'phases']: | 2588 for revs, (old, new) in tr.changes[b'phases']: |
2592 for rev in revs: | 2589 for rev in revs: |
2594 node = hex(cl.node(rev)) | 2591 node = hex(cl.node(rev)) |
2595 args.update(phases.preparehookargs(node, old, new)) | 2592 args.update(phases.preparehookargs(node, old, new)) |
2596 repo.hook( | 2593 repo.hook( |
2597 b'pretxnclose-phase', | 2594 b'pretxnclose-phase', |
2598 throw=True, | 2595 throw=True, |
2599 **pycompat.strkwargs(args) | 2596 **pycompat.strkwargs(args), |
2600 ) | 2597 ) |
2601 | 2598 |
2602 repo.hook( | 2599 repo.hook( |
2603 b'pretxnclose', throw=True, **pycompat.strkwargs(tr.hookargs) | 2600 b'pretxnclose', throw=True, **pycompat.strkwargs(tr.hookargs) |
2604 ) | 2601 ) |
2669 args = tr.hookargs.copy() | 2666 args = tr.hookargs.copy() |
2670 args.update(bookmarks.preparehookargs(name, old, new)) | 2667 args.update(bookmarks.preparehookargs(name, old, new)) |
2671 repo.hook( | 2668 repo.hook( |
2672 b'txnclose-bookmark', | 2669 b'txnclose-bookmark', |
2673 throw=False, | 2670 throw=False, |
2674 **pycompat.strkwargs(args) | 2671 **pycompat.strkwargs(args), |
2675 ) | 2672 ) |
2676 | 2673 |
2677 if hook.hashook(repo.ui, b'txnclose-phase'): | 2674 if hook.hashook(repo.ui, b'txnclose-phase'): |
2678 cl = repo.unfiltered().changelog | 2675 cl = repo.unfiltered().changelog |
2679 phasemv = sorted( | 2676 phasemv = sorted( |
2685 node = hex(cl.node(rev)) | 2682 node = hex(cl.node(rev)) |
2686 args.update(phases.preparehookargs(node, old, new)) | 2683 args.update(phases.preparehookargs(node, old, new)) |
2687 repo.hook( | 2684 repo.hook( |
2688 b'txnclose-phase', | 2685 b'txnclose-phase', |
2689 throw=False, | 2686 throw=False, |
2690 **pycompat.strkwargs(args) | 2687 **pycompat.strkwargs(args), |
2691 ) | 2688 ) |
2692 | 2689 |
2693 repo.hook( | 2690 repo.hook( |
2694 b'txnclose', throw=False, **pycompat.strkwargs(hookargs) | 2691 b'txnclose', throw=False, **pycompat.strkwargs(hookargs) |
2695 ) | 2692 ) |