brendan-duncan / image

Dart Image Library for opening, manipulating, and saving various different image file formats.
MIT License
1.14k stars 255 forks source link

Optimize copying of bytes in Image.fromBytes #612

Closed saierd closed 5 months ago

saierd commented 5 months ago

Dart 3.2 contains an optimization where setRange on typed data is performed by a simple memcpy when copying between two typed lists. See https://dart-review.googlesource.com/c/sdk/+/319521.

The optimization is only applied when the iterable passed to setRange is typed data.

This change speeds up fromBytes massively for bigger images. Copying a 10000x10000 pixel image takes ~0.13s instead of ~3.2s on my machine.

brendan-duncan commented 5 months ago

Wonderful, thank you

saierd commented 5 months ago

Thank you. Will there be a release including this change soon?

brendan-duncan commented 5 months ago

Yeah I'll try to get to that soon. Please ping me if I forget after a day or two, juggling lots of things right now

brendan-duncan commented 5 months ago

Published in 4.1.5