-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fast image allocation #2655
Fast image allocation #2655
Conversation
So, there are benchmarks. I've tested preview of Pillow-SIMD 4.3 on desktop i5-4430 on not virtualized Ubuntu 16.04. There are three columns: concurrency 1, 2 and 4. Commands to run: $ ../pillow-perf/testsuite/run.py scale crop allocate convert -n 21
$ (../pillow-perf/testsuite/run.py scale crop allocate convert -n 21
& ../pillow-perf/testsuite/run.py scale crop allocate convert -n 21)
$ (../pillow-perf/testsuite/run.py scale crop allocate convert -n 21
& ../pillow-perf/testsuite/run.py scale crop allocate convert -n 21
& ../pillow-perf/testsuite/run.py scale crop allocate convert -n 21
& ../pillow-perf/testsuite/run.py scale crop allocate convert -n 21) Each odd line (darker background) is the old code, each even line (white background) is the new. In each test the new code is faster, up to 2 times. Also, for operations which are not limited to memory bandwidth (resizing), performance degradation is most noticeable for the old code. For example:
|
Changed base to master after merging #2654 |
The Pillow's
ImagingNew
function always creates images filled with zeroes (black color). While this is fine for some operations, for others this is absolutely not required and can affect performance, especially for operations which does not required intensive computation.Zeroing is required if:
In other cases zeroing can be avoided.
This PR provides new
ImagingNewDirty
function which makes no warranties about the content of created images. Also, this PR usesImagingNewDirty
for many operations, such as resize, crop.