comparison rust/hg-core/src/revlog/path_encode.rs @ 50166:6ea3b1acb5de

rhg: in path_encode, be a bit more conservative about memory usage Use [shrink_to_fit] to match the previous behavior more closely, and potentially save (a tiny bit) of memory. FWIW, I suspect this is unnecessary, but this whole MR is about simplifying things while preserving any existing optimizations.
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Fri, 17 Feb 2023 13:29:39 +0000
parents 4180c988d1d5
children ee63c87a0cac
comparison
equal deleted inserted replaced
50165:4180c988d1d5 50166:6ea3b1acb5de
574 hexencode(&mut dest, *c); 574 hexencode(&mut dest, *c);
575 } 575 }
576 if let Some(l) = last_dot { 576 if let Some(l) = last_dot {
577 dest.write_bytes(&src[l..]); 577 dest.write_bytes(&src[l..]);
578 } 578 }
579 dest.shrink_to_fit();
579 dest 580 dest
580 } 581 }
581 582
582 fn hash_encode(src: &[u8]) -> Vec<u8> { 583 fn hash_encode(src: &[u8]) -> Vec<u8> {
583 let mut dired: DestArr<MAXENCODE> = DestArr::create(); 584 let mut dired: DestArr<MAXENCODE> = DestArr::create();