Skip to content
Snippets Groups Projects
  1. Jun 19, 2024
    • Raphaël Gomès's avatar
      revlog: add the glue to use the Rust `InnerRevlog` from Python · 7346f93be7a4
      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.
      7346f93be7a4
  2. Sep 17, 2024
  3. Nov 14, 2022
  4. Mar 09, 2022
  5. Mar 03, 2022
  6. Mar 02, 2022
  7. Dec 10, 2021
  8. Oct 12, 2021
  9. Oct 08, 2021
  10. Sep 09, 2021
    • Simon Sapin's avatar
      rust: Make OwningDirstateMap generic and move it into hg-core · 4afd6cc447b9
      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
      4afd6cc447b9
  11. Jul 04, 2021
  12. Apr 08, 2021
    • Simon Sapin's avatar
      rust: Remove the compile-time 'dirstate-tree' feature flag · 441024b279a6
      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
      441024b279a6
  13. Apr 05, 2021
  14. Jan 06, 2021
  15. Sep 30, 2020
    • Raphaël Gomès's avatar
      rust: introduce `dirstate-tree` cargo feature · e604a3c03ab9
      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
      e604a3c03ab9
  16. Sep 06, 2020
  17. May 29, 2020
    • Raphaël Gomès's avatar
      rust: remove support for `re2` · 9f96beb9bafe
      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
      9f96beb9bafe
  18. Mar 23, 2020
    • Raphaël Gomès's avatar
      rust: update all dependencies · d31d1c0685be
      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
      d31d1c0685be
  19. Mar 18, 2020
  20. Mar 06, 2020
    • Raphaël Gomès's avatar
      rust: add logging utils · 82f51ab7a2dd
      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
      82f51ab7a2dd
  21. Jan 16, 2020
    • Raphaël Gomès's avatar
      rust-re2: add wrapper for calling Re2 from Rust · d8d4fa9a7f18
      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
      d8d4fa9a7f18
  22. Jan 30, 2020
  23. Oct 14, 2019
    • Yuya Nishihara's avatar
      rust-cpython: prepare for writing tests that require libpython · 8d432d3a2d7c
      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.
      8d432d3a2d7c
  24. Oct 13, 2019
  25. Jul 02, 2019
    • Raphaël Gomès's avatar
      rust: switch hg-core and hg-cpython to rust 2018 edition · 326fdce22fb2
      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
      326fdce22fb2
  26. Dec 17, 2018
  27. Dec 03, 2018
    • Georges Racinet's avatar
      rust-cpython: start cpython crate bindings · 5532823e8c18
      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
      5532823e8c18
Loading