kornelski / lodepng-rust

All-in-one PNG image encoder/decoder in pure Rust
https://lib.rs/lodepng
zlib License
100 stars 23 forks source link

Speed and binary size of this library? #49

Closed fzyzcjy closed 3 years ago

fzyzcjy commented 3 years ago

Hi thanks for this wonderful lib! I wonder (1) how fast is it, and (2) how big is the generated binary executable, compared with traditional libpng? Thank you!

kornelski commented 3 years ago

To be honest, it's not great.

It's a straightforward translation of simple C code. It doesn't have low-level optimizations and I haven't checked if it autovectorizes (probably not).

I use it mainly because libpng as a dependency is endless suffering due to old versions being kept alive by Linux distros, and difficulty in statically vs dynamically linking libpng vs zlib as appropriate for each OS/distro (cmake chokes on it, pkg-config file may sabotage static linking, etc.)

Code size should be fine, but keep in mind it depends on Rust's standard library which is a one-time overhead for every Rust binary.

fzyzcjy commented 3 years ago

Thank you!