We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2b6ed3b commit c35a700Copy full SHA for c35a700
compiler/rustc_metadata/src/locator.rs
@@ -740,7 +740,9 @@ fn get_metadata_section(
740
// Header is okay -> inflate the actual metadata
741
let compressed_bytes = &buf[header_len..];
742
debug!("inflating {} bytes of compressed metadata", compressed_bytes.len());
743
- let mut inflated = Vec::new();
+ // Assume the decompressed data will be at least the size of the compressed data, so we
744
+ // don't have to grow the buffer as much.
745
+ let mut inflated = Vec::with_capacity(compressed_bytes.len());
746
match FrameDecoder::new(compressed_bytes).read_to_end(&mut inflated) {
747
Ok(_) => rustc_erase_owner!(OwningRef::new(inflated).map_owner_box()),
748
Err(_) => {
0 commit comments