Skip to content
Snippets Groups Projects
  1. Jan 07, 2025
  2. Dec 05, 2024
    • Georges Racinet's avatar
      rust: made the crate of hg-cpython importable · 15011324
      Georges Racinet authored
      The crate name is actually `rusthg`. This has the side effect
      of running the doctest of the `py_shared_iterator` macro which
      was really inconsistent, and after basic fixes, exposed that the
      macro itself was poorly scoped.
      15011324
  3. Nov 29, 2024
    • Georges Racinet's avatar
      rust-cpython: fix discrepancy in internal FFI lib version · 544b9d30
      Georges Racinet authored
      The dependency to `sys-python3` stayed at version 0.7.1 when `cpython`
      got bumped to 0.7.2 for Python 3.12 support. In pratice, this does not
      change much because Cargo rules imply that this means ">= 0.7.1, <0.8.0".
      
      Still it did not feel right, either `cpython` enforces a stricter version
      and this specification is not needed at all, or it meant that it was still
      possible to install the older version of `sys-python3`.
      544b9d30
  4. Nov 04, 2024
  5. Jun 19, 2024
    • Raphaël Gomès's avatar
      revlog: add the glue to use the Rust `InnerRevlog` from Python · 7346f93b
      Raphaël Gomès authored
      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.
      7346f93b
  6. Sep 17, 2024
  7. Nov 14, 2022
  8. Mar 09, 2022
  9. Mar 03, 2022
  10. Mar 02, 2022
  11. Dec 10, 2021
  12. Oct 12, 2021
  13. Oct 08, 2021
  14. Sep 09, 2021
    • Simon Sapin's avatar
      rust: Make OwningDirstateMap generic and move it into hg-core · 4afd6cc4
      Simon Sapin authored
      This will enable using it in rhg too.
      
      The `OwningDirstateMap::new_empty` constructor is generic and accepts a value
      of any type that gives acces to a bytes buffer. That buffer must stay valid
      as long as the value hasn’t been dropped, and must keep its memory address
      even if the value is moved. The `StableDeref` marker trait encodes those
      constraints. Previously no trait was needed because the value was always
      of type `PyBytes` which we know satisfies those constraints.
      
      The buffer type is ereased in the struct itself through boxing and
      dynamic dispatch, in order to simplify other signatures that mention
      `OwningDirstateMap`.
      
      Differential Revision: https://phab.mercurial-scm.org/D11396
      4afd6cc4
  15. Jul 04, 2021
  16. Apr 08, 2021
    • Simon Sapin's avatar
      rust: Remove the compile-time 'dirstate-tree' feature flag · 441024b2
      Simon Sapin authored
      This code has compiler errors since it is not built on CI and nobody has been
      working on it for some time.
      
      We (Octobus) are still pursuing status optimizations based on a tree data
      structure for the dirstate, but upcoming patches will use a run-time opt-in
      instead of compile-time, so that at least corresponding Rust code keeps
      compiling when other changes are made.
      
      Differential Revision: https://phab.mercurial-scm.org/D10329
      441024b2
  17. Apr 05, 2021
  18. Jan 06, 2021
  19. Sep 30, 2020
    • Raphaël Gomès's avatar
      rust: introduce `dirstate-tree` cargo feature · e604a3c0
      Raphaël Gomès authored
      This feature gates (at compile-time) the use of the newly-added dirstate tree.
      
      The motivation for this is that the dirstate tree is currently *very* slow;
      replacing the current hashmap-based dirstate is not a viable solution in terms
      of performance... and why would you be using the Rust implementation if not
      for performance?
      
      The feature will also help reviewers better understand the differences that
      will slowly appear as the dirstate tree gets better.
      
      Differential Revision: https://phab.mercurial-scm.org/D9132
      e604a3c0
  20. Sep 06, 2020
  21. May 29, 2020
    • Raphaël Gomès's avatar
      rust: remove support for `re2` · 9f96beb9
      Raphaël Gomès authored
      With the performance issues with `regex` figured out and fixed in previous
      patches and `regex` newly gaining support for empty alternations, there is no
      reason to keep `re2` around anymore. It's only *marginally* faster at creating
      the regex which saves at most a couple of ms, but gets beaten by `regex` in
      every other aspect.
      
      This removes the Rust/C/C++ bridge (hooray!), the `with-re2` feature, the
      conditional code that goes with it, the documentation and relevant part of the
      debug/module output.
      
      Differential Revision: https://phab.mercurial-scm.org/D8594
      9f96beb9
  22. Mar 23, 2020
    • Raphaël Gomès's avatar
      rust: update all dependencies · d31d1c06
      Raphaël Gomès authored
      We do this periodically to say up to date.
      
      No major versions were crossed this time per se, but the `rand` is still in v0,
      and their 0.7x series broke three things:
          - Some distribution-related elements were moved to a separate crate,
            flashing a deprecation warning
          - The `LogNormal::new` associated function now returns a `Result`
          - Certain RNGs were updated to sample a `u32` instead of `usize` when their
            upper-bound is less than `u32::MAX` for better portability, which changed
            the output for 2 tests.
      
      Moreover, the recent use of the `regex` crate for ignore mechanisms prompted
      some benchmarking that revealed that `regex` was slower at compiling big regex
      than `Re2`. The author of `regex` was very quick to discover an optimization
      that yielded a 30% improvement. It's still slower than `Re2` in that regard, but
      less so in the 1.3.6 release.
      
      Differential Revision: https://phab.mercurial-scm.org/D8320
      d31d1c06
  23. Mar 18, 2020
  24. Mar 06, 2020
    • Raphaël Gomès's avatar
      rust: add logging utils · 82f51ab7
      Raphaël Gomès authored
      This change adds the `log` crate, the community-approved logging facade backed
      by Rust core developers as well as the logging-consumer crate `simple_logger`
      to build a foundation for logging from Rust.
      
      Using this setup allows us to choose how to log depending on the way `hg-core`
      is used: if it's within the context of `hg-cpython`, we might not want to use
      it the same way as with a direct cli for example.
      
      Differential Revision: https://phab.mercurial-scm.org/D8252
      82f51ab7
  25. Jan 16, 2020
    • Raphaël Gomès's avatar
      rust-re2: add wrapper for calling Re2 from Rust · d8d4fa9a
      Raphaël Gomès authored
      This assumes that Re2 is installed following Google's guide. I am not sure
      how we want to integrate it in the project, but I think a follow-up patch would
      be more appropriate for such work.
      As it stands, *not* having Re2 installed results in a compilation error, which
      is a problem as it breaks install compatibility. Hence, this is gated behind
      a non-default `with-re2` compilation feature.
      
      Differential Revision: https://phab.mercurial-scm.org/D7910
      d8d4fa9a
  26. Jan 30, 2020
  27. Oct 14, 2019
    • Yuya Nishihara's avatar
      rust-cpython: prepare for writing tests that require libpython · 8d432d3a
      Yuya Nishihara authored
      What I wanted is to disable the "cpython/extension-module<ver>" feature
      while building tests executable, but that seems not doable. Instead,
      this patch adds new features dedicated for tests.
      
      The make rule is extracted so that we can easily run cargo tests.
      
      Added a minimal test of ref-sharing as an example. More tests will follow.
      8d432d3a
  28. Oct 13, 2019
  29. Jul 02, 2019
    • Raphaël Gomès's avatar
      rust: switch hg-core and hg-cpython to rust 2018 edition · 326fdce2
      Raphaël Gomès authored
      Many interesting changes have happened in Rust since the Oxidation Plan was
      introduced, like the 2018 edition and procedural macros:
      
          - Opting in to the 2018 edition is a clear benefit in terms of future
            proofing, new (nice to have) syntactical sugar notwithstanding. It
            also has a new non-lexical, non-AST based borrow checker that has
            fewer bugs(!) and allows us to write correct code that in some cases
            would have been rejected by the old one.
          - Procedural macros allow us to use the PyO3 crate which maintainers have
            expressed the clear goal of compiling on stable, which would help in
            code maintainability compared to rust-cpython.
      
      In this patch are the following changes:
          - Removing most `extern crate` uses
          - Updating `use` clauses (`crate` keyword, nested `use`)
          - Removing `mod.rs` in favor of an aptly named module file
      
      Like discussed in the mailing list (
      https://www.mercurial-scm.org/pipermail/mercurial-devel/2019-July/132316.html
      ), until Rust integration in Mercurial is considered to be out of the
      experimental phase, the maximum version of Rust allowed is whatever the latest
      version Debian packages.
      
      Differential Revision: https://phab.mercurial-scm.org/D6597
      326fdce2
  30. Dec 17, 2018
  31. Dec 03, 2018
    • Georges Racinet's avatar
      rust-cpython: start cpython crate bindings · 5532823e
      Georges Racinet authored
      This changeset introduces the hg-cpython crate,
      that compiles as a shared library holding a whole
      Python package (mercurial.rustext), with only the empty
      'ancestor' submodule for now.
      
      Such bindings will be easier and safer to develop and maintain
      that those of `hg-direct-ffi`.
      They don't involve C code, only unsafe Rust that's mostly isolated
      within the cpython crate.
      
      The long-term goal would be to import the provided modules, such
      as rustext.ancestor with mercurial.policy.importmod, same as
      we already do with cext modules.
      
      Differential Revision: https://phab.mercurial-scm.org/D5434
      5532823e
Loading