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

inflate::core::init_tree() is slow #82

Closed
Shnatsel opened this issue Jun 21, 2020 · 1 comment · Fixed by #132
Closed

inflate::core::init_tree() is slow #82

Shnatsel opened this issue Jun 21, 2020 · 1 comment · Fixed by #132

Comments

@Shnatsel
Copy link
Contributor

When opening small-ish images with png crate more than 50% of time is spent in inflate::core::init_tree function. This makes png crate 3x slower than spng according to spng crate benchmarks. Using larger images closes the gap.

Sample image demonstrating the issue (25Kb): https://github.com/aloucks/spng-rs/blob/master/spng/tests/test-002.png

Profile: https://profiler.firefox.com/public/d87cd7f7fde83f8b4ddd2ee3e5d0b4f20312ee42/flame-graph/?globalTrackOrder=0-1-2-3-4&localTrackOrderByPid=27730-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40~27839-0~27840-0-1-2-3-4~27841-0~27847-0-1-2-3-4~&thread=42&timelineType=stack&v=4

@Shnatsel
Copy link
Contributor Author

The difference is not large in absolute terms - it's 3ms with png vs 1ms with spng. But that could still be noticeable in a networked setting (2 more ms to establish a connection) or when processing a lot of small images e.g. in machine learning workloads.

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

Successfully merging a pull request may close this issue.

2 participants