diff --git a/.github/workflows/analysis-coverage.yml b/.github/workflows/analysis-coverage.yml index cafc6535..3b2d88cf 100644 --- a/.github/workflows/analysis-coverage.yml +++ b/.github/workflows/analysis-coverage.yml @@ -90,6 +90,8 @@ jobs: coverage-macos: runs-on: macos-12 name: Coverage(macOS) + env: + TEST_DECODE_THREADS: 0 # Till `brew` update to `1.14.1` steps: - uses: actions/checkout@v3 @@ -188,6 +190,8 @@ jobs: coverage-pi-heif: runs-on: macos-12 name: Pi-Heif Coverage(macOS) + env: + TEST_DECODE_THREADS: 0 # Till `brew` update to `1.14.1` steps: - uses: actions/checkout@v3 @@ -236,6 +240,7 @@ jobs: env: EXP_PH_LIBHEIF_VERSION: "" PH_LIGHT_ACTION: 1 + TEST_DECODE_THREADS: 0 # Till `brew` update to `1.14.1` steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/publish-pypi-pi_heif.yml b/.github/workflows/publish-pypi-pi_heif.yml index b9d1da74..548a424d 100644 --- a/.github/workflows/publish-pypi-pi_heif.yml +++ b/.github/workflows/publish-pypi-pi_heif.yml @@ -80,7 +80,7 @@ jobs: CIBW_BUILD: "*-macosx_x86_64" CIBW_SKIP: "cp36-* pp39-*" CIBW_TEST_SKIP: "cp311-*" - CIBW_ENVIRONMENT_MACOS: PH_LIGHT_ACTION=1 + CIBW_ENVIRONMENT_MACOS: PH_LIGHT_ACTION=1 TEST_DECODE_THREADS=0 - name: Checking built wheels run: | diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 92ed2090..85c3f66e 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -106,7 +106,7 @@ jobs: CIBW_BUILD: "*-macosx_x86_64" CIBW_SKIP: "cp36-* pp39-*" CIBW_TEST_SKIP: "cp311-*" - CIBW_ENVIRONMENT_MACOS: PH_FULL_ACTION=1 + CIBW_ENVIRONMENT_MACOS: PH_FULL_ACTION=1 TEST_DECODE_THREADS=0 - name: Check built wheels run: | diff --git a/pillow_heif/options.py b/pillow_heif/options.py index 560de223..b87a284a 100644 --- a/pillow_heif/options.py +++ b/pillow_heif/options.py @@ -6,7 +6,9 @@ DECODE_THREADS = 4 """Maximum number of threads to use for decoding images(when it is possible) -When use pillow_heif as a plugin you can set it with: `register_*_opener(decode_threads=8)`""" +When use pillow_heif as a plugin you can set it with: `register_*_opener(decode_threads=8)` + +.. note:: Currently do not work on macOS, will be fixed in `0.9.1` version""" THUMBNAILS = True diff --git a/tests/options_test.py b/tests/options_test.py index 4cf25143..83ef9cc5 100644 --- a/tests/options_test.py +++ b/tests/options_test.py @@ -83,12 +83,12 @@ def test_decode_threads(): start_time_one_thread = perf_counter() open_heif(test_image, convert_hdr_to_8bit=False).load() total_time_one_thread = perf_counter() - start_time_one_thread - options.DECODE_THREADS = 2 - start_time_two_threads = perf_counter() + options.DECODE_THREADS = os.cpu_count() + start_time_multiply_threads = perf_counter() open_heif(test_image, convert_hdr_to_8bit=False).load() - total_time_two_threads = perf_counter() - start_time_two_threads - # decoding in two threads should be faster at least by 8% - assert total_time_one_thread > total_time_two_threads * 1.08 + total_time_multiply_threads = perf_counter() - start_time_multiply_threads + # decoding in multiply threads should be faster at least by 15% + assert total_time_one_thread > total_time_multiply_threads * 1.15 finally: options.DECODE_THREADS = 4