This is an archive of the discontinued Mercurial Phabricator instance.

rust: Make NodePrefix allocation-free and Copy, remove NodePrefixRef
ClosedPublic

Authored by SimonSapin on Jan 25 2021, 4:13 PM.

Details

Summary

The *Ref struct only existed to avoid allocating Vecs
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.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

SimonSapin created this revision.Jan 25 2021, 4:13 PM
SimonSapin updated this revision to Diff 25351.Jan 28 2021, 2:39 PM
Alphare accepted this revision.Jan 29 2021, 6:46 AM
Alphare added a subscriber: Alphare.

This patch has both logic changes and the Copy bound added, which makes it harder to read, but it looks ok. I know that splitting the series even further would be a lot of work so don't bother unless someone else wants you to.

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.