Pre-allocate a Vec since the count of a TIFF field value is known.
This commit is contained in:
parent
6225236870
commit
a8620a1ff6
|
@ -75,7 +75,7 @@ fn parse_ascii<'a>(data: &'a [u8], offset: usize, count: usize)
|
|||
|
||||
fn parse_short<'a, E>(data: &'a [u8], offset: usize, count: usize)
|
||||
-> Value<'a> where E: Endian {
|
||||
let mut val = Vec::new();
|
||||
let mut val = Vec::with_capacity(count);
|
||||
for i in 0..count {
|
||||
val.push(E::loadu16(data, offset + i * 2));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue