# HG changeset patch # User Raphaël Gomès # Date 1601482253 -7200 # Node ID e604a3c03ab90d0c49264c75314c535f0cff96b2 # Parent 423f17f94f35deee85f7a1fc981bdc41ba3f2e0e rust: introduce `dirstate-tree` cargo feature 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 diff -r 423f17f94f35 -r e604a3c03ab9 Makefile --- a/Makefile Wed Sep 30 18:23:43 2020 +0200 +++ b/Makefile Wed Sep 30 18:10:53 2020 +0200 @@ -133,7 +133,7 @@ rust-tests: cd $(HGROOT)/rust/hg-cpython \ && $(CARGO) test --quiet --all \ - --no-default-features --features "$(py_feature)" + --no-default-features --features "$(py_feature) $(HG_RUST_FEATURES)" check-code: hg manifest | xargs python contrib/check-code.py diff -r 423f17f94f35 -r e604a3c03ab9 contrib/heptapod-ci.yml --- a/contrib/heptapod-ci.yml Wed Sep 30 18:23:43 2020 +0200 +++ b/contrib/heptapod-ci.yml Wed Sep 30 18:10:53 2020 +0200 @@ -41,6 +41,12 @@ variables: PYTHON: python3 +rust-cargo-test-py3-dirstate-tree: + <<: *rust_cargo_test + variables: + PYTHON: python3 + HG_RUST_FEATURES: dirstate-tree + test-py2: <<: *runtests variables: @@ -82,6 +88,15 @@ PYTHON: python3 TEST_HGMODULEPOLICY: "rust+c" +test-py3-rust-dirstate-tree: + <<: *runtests + variables: + HGWITHRUSTEXT: cpython + RUNTEST_ARGS: "--rust --blacklist /tmp/check-tests.txt" + PYTHON: python3 + TEST_HGMODULEPOLICY: "rust+c" + HG_RUST_FEATURES: "dirstate-tree" + test-py2-chg: <<: *runtests variables: diff -r 423f17f94f35 -r e604a3c03ab9 rust/README.rst --- a/rust/README.rst Wed Sep 30 18:23:43 2020 +0200 +++ b/rust/README.rst Wed Sep 30 18:10:53 2020 +0200 @@ -34,6 +34,15 @@ One day we may use this environment variable to switch to new experimental binding crates like a hypothetical ``HGWITHRUSTEXT=hpy``. +Special features +================ + +You might want to check the `features` section in ``hg-cpython/Cargo.toml``. +It may contain features that might be interesting to try out. + +To use features from the Makefile, use the `HG_RUST_FEATURES` environment +variable: for instance `HG_RUST_FEATURES="some-feature other-feature"` + Profiling ========= diff -r 423f17f94f35 -r e604a3c03ab9 rust/hg-core/Cargo.toml --- a/rust/hg-core/Cargo.toml Wed Sep 30 18:23:43 2020 +0200 +++ b/rust/hg-core/Cargo.toml Wed Sep 30 18:10:53 2020 +0200 @@ -40,3 +40,9 @@ clap = "*" pretty_assertions = "0.6.1" tempfile = "3.1.0" + +[features] +# Use a (still unoptimized) tree for the dirstate instead of the current flat +# dirstate. This is not yet recommended for performance reasons. A future +# version might make it the default, or make it a runtime option. +dirstate-tree = [] diff -r 423f17f94f35 -r e604a3c03ab9 rust/hg-core/src/dirstate.rs --- a/rust/hg-core/src/dirstate.rs Wed Sep 30 18:23:43 2020 +0200 +++ b/rust/hg-core/src/dirstate.rs Wed Sep 30 18:10:53 2020 +0200 @@ -11,6 +11,7 @@ pub mod dirs_multiset; pub mod dirstate_map; +#[cfg(feature = "dirstate-tree")] pub mod dirstate_tree; pub mod parsers; pub mod status; diff -r 423f17f94f35 -r e604a3c03ab9 rust/hg-cpython/Cargo.toml --- a/rust/hg-cpython/Cargo.toml Wed Sep 30 18:23:43 2020 +0200 +++ b/rust/hg-cpython/Cargo.toml Wed Sep 30 18:10:53 2020 +0200 @@ -10,6 +10,7 @@ [features] default = ["python27"] +dirstate-tree = ["hg-core/dirstate-tree"] # Features to build an extension module: python27 = ["cpython/python27-sys", "cpython/extension-module-2-7"]