Skip to content
/ rust Public
forked from rust-lang/rust

Commit

Permalink
Rollup merge of rust-lang#137032 - oli-obk:push-ptvssqnomkpo, r=the8472
Browse files Browse the repository at this point in the history
Decode metadata buffer in one go

Not sure if this is perf relevant at all, but it was a bit odd before

r? `@the8472`
  • Loading branch information
jhpratt authored Feb 14, 2025
2 parents 3235a0b + be2cd95 commit 8491b54
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2272,10 +2272,7 @@ impl<D: Decoder> Decodable<D> for EncodedMetadata {
let len = d.read_usize();
let mmap = if len > 0 {
let mut mmap = MmapMut::map_anon(len).unwrap();
for _ in 0..len {
(&mut mmap[..]).write_all(&[d.read_u8()]).unwrap();
}
mmap.flush().unwrap();
mmap.copy_from_slice(d.read_raw_bytes(len));
Some(mmap.make_read_only().unwrap())
} else {
None
Expand Down

0 comments on commit 8491b54

Please sign in to comment.