Python Imaging Library (Fork)
Go to file
Kevin Newton fdd80169fd Reduce memory arena contention
Previously there was one memory arena for all threads, making it
the bottleneck for multi-threaded performance. As the number of
threads increased, the contention for the lock on the arena would
grow, causing other threads to wait to acquire it.

This commit makes it use 8 memory arenas, and round-robbins how
they are assigned to threads. Threads keep track of the index that
they should use into the arena array, assigned the first time the
arena is accessed on a given thread.

When an image is first created, it is allocated from an arena.
When the logic to have multiple arenas is enabled, it then keeps
track of the index on the image, so that when deleted it can be
returned to the correct arena.

Effectively this means that in single-threaded programs, this
should not really have an effect. We also do not do this logic if
the GIL is enabled, as it effectively acts as the lock on the
default arena for us.

As expected, this approach has no real noticable effect on regular
CPython. On free-threaded CPython, however, there is a massive
difference (measuring up to about 70%).
2025-01-24 14:39:42 -05:00
_custom_build Append custom parameter to the end of sys.argv 2024-03-28 17:40:54 +00:00
.ci Removed miniconda CPPFLAGS 2025-01-16 20:57:49 +11:00
.github Use Ubuntu 22.04 for 24.04 ppc64le and s390x 2025-01-24 19:51:07 +11:00
depends Updated libwebp to 1.5.0 2024-12-20 14:46:01 +11:00
docs Updated Ubuntu arm to 24.04 with arm64 runner 2025-01-18 13:53:39 +11:00
src Reduce memory arena contention 2025-01-24 14:39:42 -05:00
Tests Merge pull request #8689 from radarhere/get_child_images 2025-01-17 22:29:50 +02:00
wheels Updated libjpeg-turbo URL 2024-12-18 10:39:52 +11:00
winbuild Merge branch 'main' into gha-windows-32-bit 2025-01-16 17:01:59 +02:00
.clang-format change AlignAfterOpenBracket in .clang-format to BlockIndent 2024-07-16 07:57:24 -05:00
.coveragerc Removed PyAccess and Image.USE_CFFI_ACCESS 2024-07-01 20:31:17 +10:00
.editorconfig editorconfig: specify 2-space indent for TOML 2023-11-06 12:42:44 +02:00
.git-blame-ignore-revs Update .git-blame-ignore-revs 2023-11-17 13:06:44 +02:00
.gitattributes Set EPS test files as binary 2018-12-29 21:53:07 -08:00
.gitignore Correct handling of vendored fribidi. 2024-11-06 14:12:51 +08:00
.gitmodules Updated wheel build process for new location 2023-09-24 22:51:42 +10:00
.pre-commit-config.yaml [pre-commit.ci] pre-commit autoupdate 2025-01-06 17:35:41 +00:00
.readthedocs.yml Added Sphinx configuration key 2025-01-13 21:07:32 +11:00
CHANGES.rst Added link to GitHub releases 2024-11-28 07:58:10 +11:00
codecov.yml Update/remove references to CHANGES.rst 2024-11-28 10:29:05 +02:00
conftest.py Add 'from __future__ import annotations' using Ruff/isort 2023-12-21 13:13:31 +02:00
LICENSE Only use start year in copyright, remove end years 2024-12-01 23:15:54 +02:00
Makefile Use CVE and CWE roles from Sphinx 8.1 2024-10-10 21:35:48 +03:00
MANIFEST.in Stop testing on AppVeyor 2024-11-02 15:41:57 +02:00
pyproject.toml Merge branch 'main' into zlib-ng 2024-12-14 19:06:00 +11:00
README.md Merge branch 'main' into gha-windows-32-bit 2025-01-16 17:01:59 +02:00
RELEASING.md Merge branch 'main' into gha-windows-32-bit 2025-01-16 17:01:59 +02:00
selftest.py Use im property 2024-08-10 10:20:08 +10:00
setup.py Reduce memory arena contention 2025-01-24 14:39:42 -05:00
tox.ini Added type hints to setup.py 2024-09-07 18:25:44 +10:00

Pillow logo

Pillow

Python Imaging Library (Fork)

Pillow is the friendly PIL fork by Jeffrey A. Clark and contributors. PIL is the Python Imaging Library by Fredrik Lundh and contributors. As of 2019, Pillow development is supported by Tidelift.

docs Documentation Status
tests GitHub Actions build status (Lint) GitHub Actions build status (Test Linux and macOS) GitHub Actions build status (Test Windows) GitHub Actions build status (Test MinGW) GitHub Actions build status (Test Cygwin) GitHub Actions build status (Test Docker) GitHub Actions build status (Wheels) Code coverage Fuzzing Status
package Zenodo Tidelift Newest PyPI version Number of PyPI downloads OpenSSF Best Practices
social Join the chat at https://gitter.im/python-pillow/Pillow Follow on https://fosstodon.org/@pillow

Overview

The Python Imaging Library adds image processing capabilities to your Python interpreter.

This library provides extensive file format support, an efficient internal representation, and fairly powerful image processing capabilities.

The core image library is designed for fast access to data stored in a few basic pixel formats. It should provide a solid foundation for a general image processing tool.

More Information

Report a Vulnerability

To report a security vulnerability, please follow the procedure described in the Tidelift security policy.