Commit Graph

33 Commits

Author SHA1 Message Date
Lysandros Nikolaou
7d2ea7665f
Fix iterations through arenas 2025-02-14 21:09:04 +01:00
pre-commit-ci[bot]
cff21412c5 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-01-31 10:29:30 -05:00
Kevin Newton
9b130e6d6c 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-31 10:29:30 -05:00
Aleksandr Karpinskii
849768df7a Remove unused declaration 2025-01-28 20:40:43 +11:00
Alexander Karpinsky
8e332eb3b0 Apply suggestions from code review
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2024-10-07 13:05:13 +04:00
Aleksandr Karpinskii
5428e3568e Deprecate ImageCore.id and ImageCore.unsafe_ptrs 2024-09-08 17:30:23 +04:00
Lysandros Nikolaou
8a54f58ac6
Merge branch 'main' into arena-thread-safe 2024-07-19 14:14:23 +02:00
Lysandros Nikolaou
ea7b5c5b66
Lock around usages of imaging memory arenas 2024-07-16 16:43:49 +02:00
pre-commit-ci[bot]
2973b041c7 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-07-16 12:58:04 +00:00
pre-commit-ci[bot]
617e7295a8 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-04-25 12:51:24 +00:00
Andrew Murray
c167d7a269 Allow GaussianBlur and BoxBlur to accept a sequence of x and y radii 2023-08-12 12:09:20 +10:00
Andrew Murray
17b19b5668 Merge branch 'main' into apng 2023-06-14 11:26:42 +10:00
Andrew Murray
aeb6e9909e Removed unused argument 2023-06-10 15:57:05 +10:00
Andrew Murray
96bdbc4afe Renamed variable 2023-04-29 19:11:02 +10:00
Andrew Murray
ebd3c47425 When saving, allow alpha differences to indicate different frames 2023-04-29 15:02:11 +10:00
Yay295
16994ccc9b
remove unused ImagingAccess->line() method def 2022-11-12 17:15:50 -06:00
Andrew Murray
948c064b28 Allow getpalette() to return less than 256 colors 2022-02-16 09:56:13 +11:00
Andrew Murray
90a52d3c0d Added width argument to polygon 2021-11-16 22:02:54 +11:00
Andrew Murray
5b0a63f76d Updated declaration to match definition 2021-06-10 19:01:12 +10:00
Andrew Murray
46b7e86bab Format with ClangFormat 2021-01-03 14:17:51 +11:00
Hugo van Kemenade
88b7b9c1f5 Remove unused externs from Imaging.h 2020-07-07 20:46:10 +03:00
Hugo
dda6145fce Since Python 3.3 IOError and WindowsError have been merged into OSError 2020-04-10 12:57:29 +03:00
Dag Wästberg
13c1b7070d add Overlay chop 2020-02-19 19:24:36 +11:00
Dag Wästberg
5e5dfbad81 add hardlight and softlight chops 2020-02-19 19:23:09 +11:00
Alexander
778b5f9fed add box parameter 2019-12-04 23:13:20 +03:00
Alexander
335f5431de dummy method 2019-11-24 17:39:49 +03:00
Andrew Murray
ca1cf59251 Changed decode buffer size to Py_ssize_t 2019-04-15 17:33:28 +10:00
Hugo
d6e3ef85c2 Add width parameter to arc, chord, ellipse, pieslice 2018-07-02 11:26:42 +03:00
Hugo
9dedbff713 Add width parameter to rectangle 2018-07-02 11:21:30 +03:00
Daniel Plakhotich
1d20056234 TGA: Add support for writing RLE data 2018-06-15 23:01:06 +03:00
Alexander
78d16d30c4 share clip8_lookups table between Resample and ColorLUT 2018-03-26 18:02:08 +03:00
Alexander
853208c65f color 3D LUT, just start 2018-03-25 15:49:42 +03:00
wiredfool
0bb3f4fee9 source layout reorg 2017-12-28 14:49:47 +00:00