Mercurial > hg
view mercurial/revlogutils/__init__.py @ 52178:bcd4962e0df9
rust-revlog: don't create an in-memory nodemap for filelogs from Python
Explanations inline.
Benchmarks from this change affect positively the only repo that showed this
being a problem:
```
### data-env-vars.name = mozilla-try-2024-03-26-ds2-pnm
# benchmark.name = hg.command.cat
# bin-env-vars.hg.flavor = rust
# bin-env-vars.hg.py-re2-module = default
# benchmark.variants.files = all-root
# benchmark.variants.output = plain
# benchmark.variants.rev = tip
default: 62.848869 ~~~~~
before-this-patch: 58.113051 (-7.54%, -4.74)
this-patch: 57.407533 (-8.66%, -5.44)
### data-env-vars.name = mozilla-try-2024-03-26-ds2-pnm
# benchmark.name = hg.command.log
# bin-env-vars.hg.flavor = rust
# bin-env-vars.hg.py-re2-module = default
# benchmark.variants.limit-rev = 10
# benchmark.variants.patch = yes
# benchmark.variants.rev = none
default: 3.173532 ~~~~~
before-this-patch: 3.543591 (+11.66%, +0.37)
this-patch: 3.297235 (+3.90%, +0.12)
```
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Wed, 31 Jul 2024 13:35:54 +0200 |
parents | f4733654f144 |
children |
line wrap: on
line source
# mercurial.revlogutils -- basic utilities for revlog # # Copyright 2019 Pierre-Yves David <pierre-yves.david@octobus.net> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from __future__ import annotations import typing from ..thirdparty import attr # Force pytype to use the non-vendored package if typing.TYPE_CHECKING: # noinspection PyPackageRequirements import attr from ..interfaces import repository # See mercurial.revlogutils.constants for doc COMP_MODE_INLINE = 2 RANK_UNKNOWN = -1 def offset_type(offset, type): if (type & ~repository.REVISION_FLAGS_KNOWN) != 0: raise ValueError(b'unknown revlog index flags: %d' % type) return int(int(offset) << 16 | type) def entry( data_offset, data_compressed_length, data_delta_base, link_rev, parent_rev_1, parent_rev_2, node_id, flags=0, data_uncompressed_length=-1, data_compression_mode=COMP_MODE_INLINE, sidedata_offset=0, sidedata_compressed_length=0, sidedata_compression_mode=COMP_MODE_INLINE, rank=RANK_UNKNOWN, ): """Build one entry from symbolic name This is useful to abstract the actual detail of how we build the entry tuple for caller who don't care about it. This should always be called using keyword arguments. Some arguments have default value, this match the value used by index version that does not store such data. """ return ( offset_type(data_offset, flags), data_compressed_length, data_uncompressed_length, data_delta_base, link_rev, parent_rev_1, parent_rev_2, node_id, sidedata_offset, sidedata_compressed_length, data_compression_mode, sidedata_compression_mode, rank, ) @attr.s(slots=True, frozen=True) class revisioninfo: """Information about a revision that allows building its fulltext node: expected hash of the revision p1, p2: parent revs of the revision (as node) btext: built text cache consisting of a one-element list cachedelta: (baserev, uncompressed_delta, usage_mode) or None flags: flags associated to the revision storage One of btext[0] or cachedelta must be set. """ node = attr.ib() p1 = attr.ib() p2 = attr.ib() btext = attr.ib() textlen = attr.ib() cachedelta = attr.ib() flags = attr.ib()