author | Raphaël Gomès <rgomes@octobus.net> |
Mon, 09 Jan 2023 18:15:29 +0100 | |
changeset 49920 | 0d301f4180f5 |
parent 49914 | 58074252db3c |
child 50979 | 4c5f6e95df84 |
permissions | -rw-r--r-- |
44386
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
1 |
// Copyright 2019-2020 Georges Racinet <georges.racinet@octobus.net> |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
2 |
// |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
3 |
// This software may be used and distributed according to the terms of the |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
4 |
// GNU General Public License version 2 or any later version. |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
5 |
|
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
6 |
use hg::revlog::node::*; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
7 |
use hg::revlog::nodemap::*; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
8 |
use hg::revlog::*; |
47955
e834b79def74
rust: Switch to the memmap2-rs crate
Simon Sapin <simon.sapin@octobus.net>
parents:
46432
diff
changeset
|
9 |
use memmap2::MmapOptions; |
44386
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
10 |
use rand::Rng; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
11 |
use std::fs::File; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
12 |
use std::io; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
13 |
use std::io::Write; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
14 |
use std::path::{Path, PathBuf}; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
15 |
use std::time::Instant; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
16 |
|
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
17 |
mod index; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
18 |
use index::Index; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
19 |
|
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
20 |
fn mmap_index(repo_path: &Path) -> Index { |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
21 |
let mut path = PathBuf::from(repo_path); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
22 |
path.extend([".hg", "store", "00changelog.i"].iter()); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
23 |
Index::load_mmap(path) |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
24 |
} |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
25 |
|
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
26 |
fn mmap_nodemap(path: &Path) -> NodeTree { |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
27 |
let file = File::open(path).unwrap(); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
28 |
let mmap = unsafe { MmapOptions::new().map(&file).unwrap() }; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
29 |
let len = mmap.len(); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
30 |
NodeTree::load_bytes(Box::new(mmap), len) |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
31 |
} |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
32 |
|
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
33 |
/// Scan the whole index and create the corresponding nodemap file at `path` |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
34 |
fn create(index: &Index, path: &Path) -> io::Result<()> { |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
35 |
let mut file = File::create(path)?; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
36 |
let start = Instant::now(); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
37 |
let mut nm = NodeTree::default(); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
38 |
for rev in 0..index.len() { |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
39 |
let rev = rev as Revision; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
40 |
nm.insert(index, index.node(rev).unwrap(), rev).unwrap(); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
41 |
} |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
42 |
eprintln!("Nodemap constructed in RAM in {:?}", start.elapsed()); |
49920
0d301f4180f5
rust-clippy: use `write_all` since we're not expecting a partial write
Raphaël Gomès <rgomes@octobus.net>
parents:
49914
diff
changeset
|
43 |
file.write_all(&nm.into_readonly_and_added_bytes().1)?; |
44386
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
44 |
eprintln!("Nodemap written to disk"); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
45 |
Ok(()) |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
46 |
} |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
47 |
|
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
48 |
fn query(index: &Index, nm: &NodeTree, prefix: &str) { |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
49 |
let start = Instant::now(); |
46432
18a261b11b20
rust: Remove hex parsing from the nodemap
Simon Sapin <simon.sapin@octobus.net>
parents:
46427
diff
changeset
|
50 |
let res = NodePrefix::from_hex(prefix).map(|p| nm.find_bin(index, p)); |
44386
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
51 |
println!("Result found in {:?}: {:?}", start.elapsed(), res); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
52 |
} |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
53 |
|
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
54 |
fn bench(index: &Index, nm: &NodeTree, queries: usize) { |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
55 |
let len = index.len() as u32; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
56 |
let mut rng = rand::thread_rng(); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
57 |
let nodes: Vec<Node> = (0..queries) |
49914
58074252db3c
rust: run `cargo clippy`
Raphaël Gomès <rgomes@octobus.net>
parents:
49637
diff
changeset
|
58 |
.map(|_| *index.node((rng.gen::<u32>() % len) as Revision).unwrap()) |
44386
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
59 |
.collect(); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
60 |
if queries < 10 { |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
61 |
let nodes_hex: Vec<String> = |
46427
6380efb82191
rust: replace Node::encode_hex with std::fmt::LowerHex
Simon Sapin <simon.sapin@octobus.net>
parents:
44386
diff
changeset
|
62 |
nodes.iter().map(|n| format!("{:x}", n)).collect(); |
44386
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
63 |
println!("Nodes: {:?}", nodes_hex); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
64 |
} |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
65 |
let mut last: Option<Revision> = None; |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
66 |
let start = Instant::now(); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
67 |
for node in nodes.iter() { |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
68 |
last = nm.find_bin(index, node.into()).unwrap(); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
69 |
} |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
70 |
let elapsed = start.elapsed(); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
71 |
println!( |
46427
6380efb82191
rust: replace Node::encode_hex with std::fmt::LowerHex
Simon Sapin <simon.sapin@octobus.net>
parents:
44386
diff
changeset
|
72 |
"Did {} queries in {:?} (mean {:?}), last was {:x} with result {:?}", |
44386
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
73 |
queries, |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
74 |
elapsed, |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
75 |
elapsed / (queries as u32), |
46427
6380efb82191
rust: replace Node::encode_hex with std::fmt::LowerHex
Simon Sapin <simon.sapin@octobus.net>
parents:
44386
diff
changeset
|
76 |
nodes.last().unwrap(), |
44386
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
77 |
last |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
78 |
); |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
79 |
} |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
80 |
|
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
81 |
fn main() { |
49637
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
82 |
use clap::{Parser, Subcommand}; |
44386
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
83 |
|
49637
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
84 |
#[derive(Parser)] |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
85 |
#[command()] |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
86 |
/// Nodemap pure Rust example |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
87 |
struct App { |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
88 |
// Path to the repository, always necessary for its index |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
89 |
#[arg(short, long)] |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
90 |
repository: PathBuf, |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
91 |
// Path to the nodemap file, independent of REPOSITORY |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
92 |
#[arg(short, long)] |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
93 |
nodemap_file: PathBuf, |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
94 |
#[command(subcommand)] |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
95 |
command: Command, |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
96 |
} |
44386
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
97 |
|
49637
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
98 |
#[derive(Subcommand)] |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
99 |
enum Command { |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
100 |
/// Create `NODEMAP_FILE` by scanning repository index |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
101 |
Create, |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
102 |
/// Query `NODEMAP_FILE` for `prefix` |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
103 |
Query { prefix: String }, |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
104 |
/// Perform #`QUERIES` random successful queries on `NODEMAP_FILE` |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
105 |
Bench { queries: usize }, |
44386
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
106 |
} |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
107 |
|
49637
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
108 |
let app = App::parse(); |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
109 |
|
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
110 |
let repo = &app.repository; |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
111 |
let nm_path = &app.nodemap_file; |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
112 |
|
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
113 |
let index = mmap_index(repo); |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
114 |
let nm = mmap_nodemap(nm_path); |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
115 |
|
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
116 |
match &app.command { |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
117 |
Command::Create => { |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
118 |
println!( |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
119 |
"Creating nodemap file {} for repository {}", |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
120 |
nm_path.display(), |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
121 |
repo.display() |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
122 |
); |
49914
58074252db3c
rust: run `cargo clippy`
Raphaël Gomès <rgomes@octobus.net>
parents:
49637
diff
changeset
|
123 |
create(&index, Path::new(nm_path)).unwrap(); |
49637
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
124 |
} |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
125 |
Command::Bench { queries } => { |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
126 |
println!( |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
127 |
"Doing {} random queries in nodemap file {} of repository {}", |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
128 |
queries, |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
129 |
nm_path.display(), |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
130 |
repo.display() |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
131 |
); |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
132 |
bench(&index, &nm, *queries); |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
133 |
} |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
134 |
Command::Query { prefix } => { |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
135 |
println!( |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
136 |
"Querying {} in nodemap file {} of repository {}", |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
137 |
prefix, |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
138 |
nm_path.display(), |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
139 |
repo.display() |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
140 |
); |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
141 |
query(&index, &nm, prefix); |
14bfd22a57a9
hg-core: upgrade `clap` dependency
Raphaël Gomès <rgomes@octobus.net>
parents:
47955
diff
changeset
|
142 |
} |
44386
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
143 |
} |
8f7c6656ac79
rust-nodemap: pure Rust example
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
144 |
} |