image-rs / jpeg-decoder

JPEG decoder written in Rust
Apache License 2.0
148 stars 87 forks source link

Optimize data copy #127

Closed lovasoa closed 4 years ago

lovasoa commented 4 years ago

Data was copied byte by byte in two nested loops. This changes the code to a single loop, using memcpy to copy one line of data at a time.

I observed a 2% performance improvement on the "decode 512x512 image" benchmark on a 2018 Macbook Pro.

This was branched from #126.

lovasoa commented 4 years ago

@fintelia : Ok, I updated indexing.