Mercurial > public > mercurial-scm > hg
comparison mercurial/vfs.py @ 52163:7346f93be7a4
revlog: add the glue to use the Rust `InnerRevlog` from Python
The performance of this has been looked at for quite some time, and some
workflows are actually quite a bit faster than with the Python + C code.
However, we are still (up to 20%) slower in some crucial places like cloning
certain repos, log, cat, which makes this an incomplete rewrite. This is
mostly due to the high amount of overhead in Python <-> Rust FFI, especially
around the VFS code. A future patch series will rewrite the VFS code in
pure Rust, which should hopefully get us up to par with current perfomance,
if not better in all important cases.
This is a "save state" of sorts, as this is a ton of code, and I don't want
to pile up even more things in a single review.
Continuing to try to match the current performance will take an extremely
long time, if it's not impossible, without the aforementioned VFS work.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Wed, 19 Jun 2024 19:10:49 +0200 |
parents | 992fcf6b2473 |
children | 5cc8deb96b48 |
comparison
equal
deleted
inserted
replaced
52162:13815c9decd4 | 52163:7346f93be7a4 |
---|---|
79 # Other vfs code always use `/` and this works fine because python file API | 79 # Other vfs code always use `/` and this works fine because python file API |
80 # abstract the use of `/` and make it work transparently. For consistency | 80 # abstract the use of `/` and make it work transparently. For consistency |
81 # vfs will always use `/` when joining. This avoids some confusion in | 81 # vfs will always use `/` when joining. This avoids some confusion in |
82 # encoded vfs (see issue6546) | 82 # encoded vfs (see issue6546) |
83 _dir_sep: bytes = b'/' | 83 _dir_sep: bytes = b'/' |
84 | |
85 # Used to disable the Rust `InnerRevlog` in case the VFS is not supported | |
86 # by the Rust code | |
87 rust_compatible = True | |
84 | 88 |
85 # TODO: type return, which is util.posixfile wrapped by a proxy | 89 # TODO: type return, which is util.posixfile wrapped by a proxy |
86 @abc.abstractmethod | 90 @abc.abstractmethod |
87 def __call__(self, path: bytes, mode: bytes = b'rb', **kwargs) -> Any: | 91 def __call__(self, path: bytes, mode: bytes = b'rb', **kwargs) -> Any: |
88 ... | 92 ... |