Skip to content

Commit 69dbedd

Browse files
Rollup merge of rust-lang#137032 - oli-obk:push-ptvssqnomkpo, r=the8472
Decode metadata buffer in one go Not sure if this is perf relevant at all, but it was a bit odd before r? ``@the8472``
2 parents 388823c + be2cd95 commit 69dbedd

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Diff for: compiler/rustc_metadata/src/rmeta/encoder.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -2272,10 +2272,7 @@ impl<D: Decoder> Decodable<D> for EncodedMetadata {
22722272
let len = d.read_usize();
22732273
let mmap = if len > 0 {
22742274
let mut mmap = MmapMut::map_anon(len).unwrap();
2275-
for _ in 0..len {
2276-
(&mut mmap[..]).write_all(&[d.read_u8()]).unwrap();
2277-
}
2278-
mmap.flush().unwrap();
2275+
mmap.copy_from_slice(d.read_raw_bytes(len));
22792276
Some(mmap.make_read_only().unwrap())
22802277
} else {
22812278
None

0 commit comments

Comments
 (0)