Skip to content

Commit 0f883c3

Browse files
committed
read_avif: Collapse primary_items_extents_data with Vec::concat instead of Iterator::flatten.
This improves the runtime of the public_avif_read_samples test from >20s to <0.3s. In optimized builds, there's no performance issue with Iterator::flatten, so the runtime of both versions are the same.
1 parent cd179f2 commit 0f883c3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mp4parse/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ pub fn read_avif<T: Read>(f: &mut T, context: &mut AvifContext) -> Result<()> {
13381338
}
13391339
}
13401340

1341-
context.primary_item = primary_item_extents_data.into_iter().flatten().collect();
1341+
context.primary_item = primary_item_extents_data.concat();
13421342

13431343
Ok(())
13441344
}

0 commit comments

Comments
 (0)