Mercurial > hg
comparison rust/hg-core/src/dirstate_tree/status.rs @ 49913:c15b415d1bff
rust: use `logging_timer` instead of `micro_timer`
I am the author of `micro_timer`.
I built it at the time because I couldn't find a crate that was simple to use
and flexible to do function timing with. Turns out I just couldn't find it
because crates.io's search isn't all that great, or maybe I didn't look hard
enough.
`logging_timer` is better in every way:
- supports changing the logging level
- supports start and end logging
- supports intermediary messages
- supports inline macros
- supports formatting the output
- better IDE/tree-sitter integration thanks to a more robust proc macro
I also changed all uses to one-liners, so it's easier to copy-paste.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Fri, 06 Jan 2023 18:52:04 +0100 |
parents | e0c0545e2e55 |
children | e98fd81bb151 |
comparison
equal
deleted
inserted
replaced
49912:bc83ebe07bf0 | 49913:c15b415d1bff |
---|---|
17 use crate::DirstateStatus; | 17 use crate::DirstateStatus; |
18 use crate::HgPathCow; | 18 use crate::HgPathCow; |
19 use crate::PatternFileWarning; | 19 use crate::PatternFileWarning; |
20 use crate::StatusError; | 20 use crate::StatusError; |
21 use crate::StatusOptions; | 21 use crate::StatusOptions; |
22 use micro_timer::timed; | |
23 use once_cell::sync::OnceCell; | 22 use once_cell::sync::OnceCell; |
24 use rayon::prelude::*; | 23 use rayon::prelude::*; |
25 use sha1::{Digest, Sha1}; | 24 use sha1::{Digest, Sha1}; |
26 use std::borrow::Cow; | 25 use std::borrow::Cow; |
27 use std::io; | 26 use std::io; |
37 /// and variable names) and dirstate tree at the same time. The core of this | 36 /// and variable names) and dirstate tree at the same time. The core of this |
38 /// traversal is the recursive `traverse_fs_directory_and_dirstate` function | 37 /// traversal is the recursive `traverse_fs_directory_and_dirstate` function |
39 /// and its use of `itertools::merge_join_by`. When reaching a path that only | 38 /// and its use of `itertools::merge_join_by`. When reaching a path that only |
40 /// exists in one of the two trees, depending on information requested by | 39 /// exists in one of the two trees, depending on information requested by |
41 /// `options` we may need to traverse the remaining subtree. | 40 /// `options` we may need to traverse the remaining subtree. |
42 #[timed] | 41 #[logging_timer::time("trace")] |
43 pub fn status<'dirstate>( | 42 pub fn status<'dirstate>( |
44 dmap: &'dirstate mut DirstateMap, | 43 dmap: &'dirstate mut DirstateMap, |
45 matcher: &(dyn Matcher + Sync), | 44 matcher: &(dyn Matcher + Sync), |
46 root_dir: PathBuf, | 45 root_dir: PathBuf, |
47 ignore_files: Vec<PathBuf>, | 46 ignore_files: Vec<PathBuf>, |