Skip to content

Performance when required multiple different resizes #228

Open
@fredgido

Description

@fredgido

Hello, I am having some performance doubts.
My use case is resizing a large image into 3 different ones on a single core VPS.

It goes like this, a single jpg is read from memory, resized and saved the resized pyvips.Image is kept for later reuse, before saving it to a jpg.
Then the same is done for the middle size sample, reusing the previous resized for performance.
And finally the same is done for the thumbnail sized sample, also reusing the previous resized for performance.

Here is my benchmark. https://gist.github.com/fredgido/c09a4ed2456a14e8e1b4afba10589e75 , used sample image linked in code.
On my laptop PIL 1.7433s vs VIPS 1.9279s when doing it like the way I said above, more detail on timmings on bellow the code text file on the gist.
From those you can conclude it takes half of the time copying memory.

Doing like PIL it looked like to me like it was rereading the jpg and breaking performance. I tried a solution that was copy_memory but this still makes it take half of the time copying the memory around.

Am I missing something or it is related to how pyvips works?

As i see pyvips is faster, but on this middle stage reuse is making me think I am missing something.
And so I am here asking help making faster than PIL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions