Benchmarks thread
bigcat88 opened this issue · 1 comments
After this issue #53 and as this project comes closer to final stage, wrote small tests, and will post them here for now.
Hardware: mac Mini M1 and Intel 10900k.
When benchmarking version 0.9.0
I set default number of decode threads to 8
(for clarity), other versions do not support this parameter, but libheif defaults it to 4
.
There was a bug in libheif, when it was compiled with Cmake it had turned off multithreading and was working in single threaded mode. That was fixed in new upcoming release and you can see it on graphs(0.5.1
for Linux has no this bug, 0.6.0
has).
Temporary code that was written today:
import sys
from subprocess import run
from time import perf_counter
def measure_decode(image, n_iterations):
cmd = f"{sys.executable} {__file__} {n_iterations} {image}".split()
start_time = perf_counter()
run(cmd, check=True)
total_time = perf_counter() - start_time
return total_time / n_iterations
if __name__ == "__main__":
from PIL import Image
from pillow_heif import register_heif_opener, __version__
_args = {}
if __version__ != "0.1.6":
_args["decode_threads"] = 8
register_heif_opener(**_args)
for i in range(int(sys.argv[1])):
im = Image.open(sys.argv[2])
im.load()
sys.exit(0)
Two test images was taken from that issue and from this repo i took cat.hif
(HDR image, with 2 thumbnails)