Mercurial > hg
diff rust/hg-core/src/dirstate_tree/dirstate_map.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 | f8ec7b16c98f |
children | 5fff90c7ea9d |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Thu Jan 12 16:15:51 2023 +0000 +++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Fri Jan 06 18:52:04 2023 +0100 @@ -1,5 +1,4 @@ use bytes_cast::BytesCast; -use micro_timer::timed; use std::borrow::Cow; use std::path::PathBuf; @@ -454,7 +453,7 @@ } } - #[timed] + #[logging_timer::time("trace")] pub fn new_v2( on_disk: &'on_disk [u8], data_size: usize, @@ -467,7 +466,7 @@ } } - #[timed] + #[logging_timer::time("trace")] pub fn new_v1( on_disk: &'on_disk [u8], ) -> Result<(Self, Option<DirstateParents>), DirstateError> { @@ -1208,7 +1207,7 @@ }) } - #[timed] + #[logging_timer::time("trace")] pub fn pack_v1( &self, parents: DirstateParents, @@ -1248,7 +1247,7 @@ /// appended to the existing data file whose content is at /// `map.on_disk` (true), instead of written to a new data file /// (false), and the previous size of data on disk. - #[timed] + #[logging_timer::time("trace")] pub fn pack_v2( &self, can_append: bool,