Skip to content

Commit

Permalink
Merge pull request #7227 from Yay295/bench_formatting
Browse files Browse the repository at this point in the history
bench_cffi_access print formatting
  • Loading branch information
radarhere committed Jun 22, 2023
2 parents 1f7e67c + ff4c7ff commit 63d6221
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions Tests/bench_cffi_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,19 @@ def timer(func, label, *args):
for x in range(iterations):
func(*args)
if time.time() - starttime > 10:
print(
"{}: breaking at {} iterations, {:.6f} per iteration".format(
label, x + 1, (time.time() - starttime) / (x + 1.0)
)
)
break
if x == iterations - 1:
endtime = time.time()
print(
"{}: {:.4f} s {:.6f} per iteration".format(
label, endtime - starttime, (endtime - starttime) / (x + 1.0)
)
endtime = time.time()
print(
"{}: completed {} iterations in {:.4f}s, {:.6f}s per iteration".format(
label, x + 1, endtime - starttime, (endtime - starttime) / (x + 1.0)
)
)


def test_direct():
im = hopper()
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)
access = PyAccess.new(im, False)

Expand Down

0 comments on commit 63d6221

Please sign in to comment.