diff options
| author | Wesley Wiser <wwiser@gmail.com> | 2017-12-22 22:41:09 -0500 |
|---|---|---|
| committer | Wesley Wiser <wwiser@gmail.com> | 2018-01-09 20:20:50 -0500 |
| commit | 01c890ee961aa18e2bfea5c07f4cdd9a29053479 (patch) | |
| tree | c0ad85a7ec52c381088e8107ee6b8f01869bbe88 /src/libserialize | |
| parent | fc2424b988c926004b93c28524be7f8a9388bdf7 (diff) | |
| download | rust-01c890ee961aa18e2bfea5c07f4cdd9a29053479.tar.gz rust-01c890ee961aa18e2bfea5c07f4cdd9a29053479.zip | |
[incremental] Specialize encoding and decoding of Fingerprints
This saves the storage space used by about 32 bits per `Fingerprint`.
On average, this reduces the size of the `/target/{mode}/incremental`
folder by roughly 5%.
Fixes #45875
Diffstat (limited to 'src/libserialize')
| -rw-r--r-- | src/libserialize/opaque.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libserialize/opaque.rs b/src/libserialize/opaque.rs index 4b2549a1aed..409366102ba 100644 --- a/src/libserialize/opaque.rs +++ b/src/libserialize/opaque.rs @@ -175,11 +175,12 @@ impl<'a> Decoder<'a> { } pub fn read_raw_bytes(&mut self, s: &mut [u8]) -> Result<(), String> { - let len = s.len(); + let start = self.position; + let end = start + s.len(); - self.position += len; + s.copy_from_slice(&self.data[start..end]); - s.copy_from_slice(&self.data[0..len]); + self.position = end; Ok(()) } |
