Mercurial > hg
annotate rust/hg-core/Cargo.toml @ 48950:11c0411bf4e2
dirstate-tree: optimize HashMap lookups with raw_entry_mut
This switches to using `HashMap` from the hashbrown crate,
in order to use its `raw_entry_mut` method.
The standard library’s `HashMap` is also based on this same crate,
but `raw_entry_mut` is not yet stable there:
https://github.com/rust-lang/rust/issues/56167
Using version 0.9 because 0.10 is yanked and 0.11 requires Rust 1.49
This replaces in `DirstateMap::get_or_insert_node` a call to
`HashMap<K, V>::entry` with `K = WithBasename<Cow<'on_disk, HgPath>>`.
`entry` takes and consumes an "owned" `key: K` parameter, in case a new entry
ends up inserted. This key is converted by `to_cow` from a value that borrows
the `'path` lifetime.
When this function is called by `Dirstate::new_v1`, `'path` is in fact
the same as `'on_disk` so `to_cow` can return an owned key that contains
`Cow::Borrowed`.
For other callers, `to_cow` needs to create a `Cow::Owned` and thus make
a costly heap memory allocation. This is wasteful if this key was already
present in the map. Even when inserting a new node this is typically the case
for its ancestor nodes (assuming most directories have numerous descendants).
Differential Revision: https://phab.mercurial-scm.org/D12317
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Tue, 08 Feb 2022 15:51:52 +0100 |
parents | 0dc698c91ca0 |
children | ec8d9b5a5e7c |
rev | line source |
---|---|
40271
dbc28c91f7ff
rust: pure Rust lazyancestors iterator
Georges Racinet <gracinet@anybox.fr>
parents:
diff
changeset
|
1 [package] |
dbc28c91f7ff
rust: pure Rust lazyancestors iterator
Georges Racinet <gracinet@anybox.fr>
parents:
diff
changeset
|
2 name = "hg-core" |
dbc28c91f7ff
rust: pure Rust lazyancestors iterator
Georges Racinet <gracinet@anybox.fr>
parents:
diff
changeset
|
3 version = "0.1.0" |
dbc28c91f7ff
rust: pure Rust lazyancestors iterator
Georges Racinet <gracinet@anybox.fr>
parents:
diff
changeset
|
4 authors = ["Georges Racinet <gracinet@anybox.fr>"] |
dbc28c91f7ff
rust: pure Rust lazyancestors iterator
Georges Racinet <gracinet@anybox.fr>
parents:
diff
changeset
|
5 description = "Mercurial pure Rust core library, with no assumption on Python bindings (FFI)" |
42609
326fdce22fb2
rust: switch hg-core and hg-cpython to rust 2018 edition
Raphaël Gomès <rgomes@octobus.net>
parents:
42331
diff
changeset
|
6 edition = "2018" |
40271
dbc28c91f7ff
rust: pure Rust lazyancestors iterator
Georges Racinet <gracinet@anybox.fr>
parents:
diff
changeset
|
7 |
dbc28c91f7ff
rust: pure Rust lazyancestors iterator
Georges Racinet <gracinet@anybox.fr>
parents:
diff
changeset
|
8 [lib] |
dbc28c91f7ff
rust: pure Rust lazyancestors iterator
Georges Racinet <gracinet@anybox.fr>
parents:
diff
changeset
|
9 name = "hg" |
41692
ee7b7bd432a1
rust: translated random test of missingancestors
Georges Racinet <gracinet@anybox.fr>
parents:
40271
diff
changeset
|
10 |
42302
d1786c1d34fa
rust-dirstate: add rust implementation of `parse_dirstate` and `pack_dirstate`
Raphaël Gomès <rgomes@octobus.net>
parents:
41692
diff
changeset
|
11 [dependencies] |
48042
008959fcbfb2
rust: Align DirstateEntry internals with Python/C DirstateItem
Simon Sapin <simon.sapin@octobus.net>
parents:
47981
diff
changeset
|
12 bitflags = "1.2" |
47102
d6c94ca40863
dirstate-tree: Serialize to disk
Simon Sapin <simon.sapin@octobus.net>
parents:
46890
diff
changeset
|
13 bytes-cast = "0.2" |
44599
d31d1c0685be
rust: update all dependencies
Raphaël Gomès <rgomes@octobus.net>
parents:
44598
diff
changeset
|
14 byteorder = "1.3.4" |
46435
2e2033081274
rust: replace trivial `impl From …` with `#[derive(derive_more::From)]`
Simon Sapin <simon.sapin@octobus.net>
parents:
46431
diff
changeset
|
15 derive_more = "0.99" |
48950
11c0411bf4e2
dirstate-tree: optimize HashMap lookups with raw_entry_mut
Simon Sapin <simon.sapin@octobus.net>
parents:
48554
diff
changeset
|
16 hashbrown = {version = "0.9.1", features = ["rayon"]} |
46483
2845892dd489
rust: Parse system and user configuration
Simon Sapin <simon.sapin@octobus.net>
parents:
46435
diff
changeset
|
17 home = "0.5" |
45963
0d99778af68a
copies-rust: use immutable "OrdMap" to store copies information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45614
diff
changeset
|
18 im-rc = "15.0.*" |
47113
be579775c2d9
dirstate-tree: Add the new `status()` algorithm
Simon Sapin <simon.sapin@octobus.net>
parents:
47102
diff
changeset
|
19 itertools = "0.9" |
44599
d31d1c0685be
rust: update all dependencies
Raphaël Gomès <rgomes@octobus.net>
parents:
44598
diff
changeset
|
20 lazy_static = "1.4.0" |
48195
4d5a13253d34
dirstate-v2: Replace the 32-bit `mode` field with two bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48042
diff
changeset
|
21 libc = "0.2" |
48554
0dc698c91ca0
rust: upgrade `rand*` crates
Martin von Zweigbergk <martinvonz@google.com>
parents:
48492
diff
changeset
|
22 rand = "0.8.4" |
0dc698c91ca0
rust: upgrade `rand*` crates
Martin von Zweigbergk <martinvonz@google.com>
parents:
48492
diff
changeset
|
23 rand_pcg = "0.3.1" |
0dc698c91ca0
rust: upgrade `rand*` crates
Martin von Zweigbergk <martinvonz@google.com>
parents:
48492
diff
changeset
|
24 rand_distr = "0.4.2" |
44158
161958ebf73c
rust-dependencies: update rayon
Raphaël Gomès <rgomes@octobus.net>
parents:
44143
diff
changeset
|
25 rayon = "1.3.0" |
44869
4313a0d7540d
rust-dependencies: update `regex` to 1.3.9
Raphaël Gomès <rgomes@octobus.net>
parents:
44599
diff
changeset
|
26 regex = "1.3.9" |
47380
fad504cfc94b
rust: Use a maintained crate for SHA-1 hashing
Simon Sapin <simon.sapin@octobus.net>
parents:
47349
diff
changeset
|
27 sha-1 = "0.9.6" |
43826
5ac243a92e37
rust-performance: introduce FastHashMap type alias for HashMap
Raphaël Gomès <rgomes@octobus.net>
parents:
43271
diff
changeset
|
28 twox-hash = "1.5.0" |
44301
4caac36c66bc
rust-utils: add util for canonical path
Raphaël Gomès <rgomes@octobus.net>
parents:
44266
diff
changeset
|
29 same-file = "1.0.6" |
47954
4afd6cc447b9
rust: Make OwningDirstateMap generic and move it into hg-core
Simon Sapin <simon.sapin@octobus.net>
parents:
47380
diff
changeset
|
30 stable_deref_trait = "1.2.0" |
47349
7138c863d0a1
dirstate-v2: Skip readdir in status based on directory mtime
Simon Sapin <simon.sapin@octobus.net>
parents:
47113
diff
changeset
|
31 tempfile = "3.1.0" |
46054
fd47483f1645
rust: use crossbeam-channel crate directly
Simon Sapin <simon-commits@exyr.org>
parents:
45963
diff
changeset
|
32 crossbeam-channel = "0.4" |
44935
2093b2fc70d4
rust-dependencies: upgrade `micro-timer` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
44870
diff
changeset
|
33 micro-timer = "0.3.0" |
44540
82f51ab7a2dd
rust: add logging utils
Raphaël Gomès <rgomes@octobus.net>
parents:
44539
diff
changeset
|
34 log = "0.4.8" |
47981
d1d9510f73f0
rust: Update the memmap2 crate to version 0.4.0
Simon Sapin <simon.sapin@octobus.net>
parents:
47955
diff
changeset
|
35 memmap2 = {version = "0.4", features = ["stable_deref_trait"]} |
45526
26c53ee51c68
hg-core: Add a limited read only `revlog` implementation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44935
diff
changeset
|
36 zstd = "0.5.3" |
48492
d3ec82016104
rust: Upgrade to format-bytes 0.3
Simon Sapin <simon.sapin@octobus.net>
parents:
48195
diff
changeset
|
37 format-bytes = "0.3.0" |
45526
26c53ee51c68
hg-core: Add a limited read only `revlog` implementation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44935
diff
changeset
|
38 |
45614
7bd13bf99d1c
rust: update minimum supported Rust compiler version
Raphaël Gomès <rgomes@octobus.net>
parents:
45609
diff
changeset
|
39 # We don't use the `miniz-oxide` backend to not change rhg benchmarks and until |
7bd13bf99d1c
rust: update minimum supported Rust compiler version
Raphaël Gomès <rgomes@octobus.net>
parents:
45609
diff
changeset
|
40 # we have a clearer view of which backend is the fastest. |
45526
26c53ee51c68
hg-core: Add a limited read only `revlog` implementation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44935
diff
changeset
|
41 [dependencies.flate2] |
26c53ee51c68
hg-core: Add a limited read only `revlog` implementation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44935
diff
changeset
|
42 version = "1.0.16" |
26c53ee51c68
hg-core: Add a limited read only `revlog` implementation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44935
diff
changeset
|
43 features = ["zlib"] |
26c53ee51c68
hg-core: Add a limited read only `revlog` implementation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44935
diff
changeset
|
44 default-features = false |
44265
c18dd48cea4a
rust-pathauditor: add Rust implementation of the `pathauditor`
Raphaël Gomès <rgomes@octobus.net>
parents:
44158
diff
changeset
|
45 |
c18dd48cea4a
rust-pathauditor: add Rust implementation of the `pathauditor`
Raphaël Gomès <rgomes@octobus.net>
parents:
44158
diff
changeset
|
46 [dev-dependencies] |
44386
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
44305
diff
changeset
|
47 clap = "*" |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
44305
diff
changeset
|
48 pretty_assertions = "0.6.1" |