[Commented On] D8958: hg-core: Add a limited read only `revlog` implementation

Alphare (Raphaël Gomès) phabricator at mercurial-scm.org
Fri Aug 28 13:35:10 UTC 2020


Alphare added inline comments.

INLINE COMMENTS

> Alphare wrote in index.rs:121
> This needlessly allocates a `Vec<u8>`, this version doesn't:
> 
>   let mut arr = [0;8];
>   arr.copy_from_slice(&self.bytes[0..=5]);
> 
> You can compare the assembly output here: https://godbolt.org/z/rdbb4P. (I've also tried a very dumb version with manual indexing and no ByteOrder, but index checking doesn't kick in and is less readable anyway.

Oops, should be

  let mut arr = [0;8];
  arr[2..8].copy_from_slice(&bytes[0..=5]);

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8958/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8958

To: acezar, #hg-reviewers, Alphare
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200828/00d622a9/attachment-0002.html>


More information about the Mercurial-patches mailing list