mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-23 15:54:09 +03:00
use same print format regardless of iterations
This commit is contained in:
parent
56a795c8dd
commit
ff4c7ffcea
|
@ -27,17 +27,11 @@ def timer(func, label, *args):
|
||||||
for x in range(iterations):
|
for x in range(iterations):
|
||||||
func(*args)
|
func(*args)
|
||||||
if time.time() - starttime > 10:
|
if time.time() - starttime > 10:
|
||||||
print(
|
|
||||||
"{}: breaking at {} iterations, {:.6f}s per iteration".format(
|
|
||||||
label, x + 1, (time.time() - starttime) / (x + 1.0)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
break
|
break
|
||||||
if x == iterations - 1:
|
|
||||||
endtime = time.time()
|
endtime = time.time()
|
||||||
print(
|
print(
|
||||||
"{}: {:.4f}s total, {:.6f}s per iteration".format(
|
"{}: completed {} iterations in {:.4f}s, {:.6f}s per iteration".format(
|
||||||
label, endtime - starttime, (endtime - starttime) / (x + 1.0)
|
label, x + 1, endtime - starttime, (endtime - starttime) / (x + 1.0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -45,7 +39,7 @@ def timer(func, label, *args):
|
||||||
def test_direct():
|
def test_direct():
|
||||||
im = hopper()
|
im = hopper()
|
||||||
im.load()
|
im.load()
|
||||||
# im = Image.new( "RGB", (2000, 2000), (1, 3, 2))
|
# im = Image.new("RGB", (2000, 2000), (1, 3, 2))
|
||||||
caccess = im.im.pixel_access(False)
|
caccess = im.im.pixel_access(False)
|
||||||
access = PyAccess.new(im, False)
|
access = PyAccess.new(im, False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user