Mercurial > public > mercurial-scm > hg
diff rust/hg-core/src/revlog/revlog.rs @ 46431:645ee7225fab
rust: Make NodePrefix allocation-free and Copy, remove NodePrefixRef
The `*Ref` struct only existed to avoid allocating `Vec`s
when cloning `NodePrefix`, but we can avoid having `Vec`
in the first place by using an inline array instead.
This makes `NodePrefix` 21 bytes (with 1?for the length)
which is smaller than before as `Vec` alone is 24 bytes.
Differential Revision: https://phab.mercurial-scm.org/D9863
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 25 Jan 2021 11:48:47 +0100 |
parents | 0800aa42bb4c |
children | 4b381dbbf8b7 |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/revlog.rs Sat Jan 30 18:30:11 2021 +0800 +++ b/rust/hg-core/src/revlog/revlog.rs Mon Jan 25 11:48:47 2021 +0100 @@ -11,7 +11,7 @@ use zstd; use super::index::Index; -use super::node::{NodePrefixRef, NODE_BYTES_LENGTH, NULL_NODE}; +use super::node::{NodePrefix, NODE_BYTES_LENGTH, NULL_NODE}; use super::nodemap; use super::nodemap::NodeMap; use super::nodemap_docket::NodeMapDocket; @@ -117,7 +117,7 @@ #[timed] pub fn get_node_rev( &self, - node: NodePrefixRef, + node: NodePrefix, ) -> Result<Revision, RevlogError> { if let Some(nodemap) = &self.nodemap { return nodemap