PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Performance: hand single-part tiles to put without a copy (#5108)
David Mann0604f39d97f2
diff --git a/crates/gpu/src/lib.rs b/crates/gpu/src/lib.rsindex 42a0364e6..37aaea8e5 100644--- a/crates/gpu/src/lib.rs+++ b/crates/gpu/src/lib.rs@@ -2181,7 +2181,11 @@ fn convert_tiles(surface: &Surface, tiles: Vec<(TileCoord, Arc<Tile>)>, kind: Te})});for ((t, cs), bytes) in batch.iter().zip(parts.chunks(bands as usize)) {- put(t, cs, &bytes.concat());+ // One part (every format but CMYK and Lab) goes through as is: no copy per tile.+ match bytes {+ [one] => put(t, cs, one),+ _ => put(t, cs, &bytes.concat()),+ }}}groups.len()