Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performance poor respect to libjpegturbo in tensorflow #16

Open
edgarriba opened this issue Mar 17, 2024 · 2 comments
Open

performance poor respect to libjpegturbo in tensorflow #16

edgarriba opened this issue Mar 17, 2024 · 2 comments

Comments

@edgarriba
Copy link
Contributor

hi! i've been using this crate for a while for the kornia-rs repository and recently we benchmarked against different existing libraries and we found that the implementation of the decompress function is quite slow compared to the one in tensorflow.

You can check here some numbers: kornia/kornia-rs#58

Digging a bit into it, i found that mainly this crate uses the raw::tj3Decompress8 that encapsulates all the logic in there, while in the tensorflow version seems a bit more sophisticated and the time results seems quite considerable to review the current implementation.

Happy to assist with anything.

@edgarriba
Copy link
Contributor Author

for reference another and more simplistic implementation: https://github.com/stevenlovegrove/Pangolin/blob/master/components/pango_image/src/image_io_jpg.cpp

@honzasp
Copy link
Owner

honzasp commented Mar 17, 2024

Hi, the TurboJPEG API used by this crate is a relatively thin wrapper around the libjpeg API, so it should not, by itself, cause degraded performance. It certainly should not make decompression 4x slower!

In the benchmark results that you refer to, the test image is very small and the reported times are in 10s of microseconds, which is so low that the benchmark might be strongly influenced by other factors besides raw decoding speed. For example, one way to make the comparison a bit more fair is to remove the file I/O from the equation by decoding from bytes that are already loaded into memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants