Pre-allocate a Vec since the count of a TIFF field value is known.

This commit is contained in:
KAMADA Ken'ichi 2016-11-16 23:13:29 +09:00
parent 6225236870
commit a8620a1ff6
1 changed files with 1 additions and 1 deletions

View File

@ -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));
}