D7790: rust-node: handling binary Node prefix
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Jan 21 12:55:59 EST 2020
martinvonz added a comment.
In D7790#116757 <https://phab.mercurial-scm.org/D7790#116757>, @gracinet wrote:
> @martinvonz in this code, we're in competition with the C implementation, which does something similar.
> Switching to a full u8 per nybble is more than a few minutes, it means changing the ownership model completely. Also, it introduces a new allocation and a copy instead of merely taking a reference.
Depends on the definition of `NodePrefixRef`. I don't think there would be any extra allocation if you define it like this:
pub enum NodePrefixRef<'a> {
Full(&'a Node),
Prefix(&'a NodePrefix),
}
> So, it's more work and has performance impact that we have no means to measure.
> The odd/even thing is not *that* complicated. It's very bad for readability in the C code, but it's nicely encapsulated in the Rust case and fully tested. I'd be more comfortable trying what you're suggesting once we have real-life measurements.
Sure, please revisit it when you can do measurements.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D7790/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D7790
To: gracinet, #hg-reviewers
Cc: martinvonz, durin42, kevincox, mercurial-devel
More information about the Mercurial-devel
mailing list