Skip to content

Slow path detected when compressing a big file #35

Open
@raysan5

Description

@raysan5

Hi! When trying to compress a 4096x4096 RGBA (32bit per pixel) image I noticed it was quite slow (about 14 seconds on my old [email protected], 8GB RAM), compiled in release mode, optimized for fast.

Analysing the process with Visual Studio 2022 it seems to find a Hot Path in sdefl_fnd() and sdefl_uload32(), is it expected? Do you know if there could be any issue in that point?

rpng_save_image_sdefl_fnd_slow_path

I tested saving the same image data with stbi_write_png() and it takes about 4 seconds.

For comparison I also tested it with the QOI file format and it takes less than a second.

About the output compressed sizes (it could be related), I got:

 - rpng (sdefl) -> 5012KB
 - stbi ---------> 7392KB
 - qoi ----------> 8792KB

Maybe the issue is on my side when providing the scanlines for compression? The compression size is quite small, it makes sense it could take way longer to process...

Please, note that this is more an issue for discussion than an actual problem, it just call my attention and I decided to ask.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions