benchmark

This commit is contained in:
Ryan Oldenburg 2021-06-17 21:25:54 -05:00
parent aeb531aedb
commit e16fcb595d
2 changed files with 5 additions and 1 deletions

View file

@ -209,7 +209,7 @@ proc minifyBy2*(image: Image, power = 1): Image =
return image.copy()
var src = image
for i in 1 .. power:
for _ in 1 .. power:
result = newImage(src.width div 2, src.height div 2)
for y in 0 ..< result.height:
for x in 0 ..< result.width:

View file

@ -33,6 +33,10 @@ timeIt "minifyBy2":
let minified = image.minifyBy2()
doAssert minified[0, 0] == rgba(63, 127, 191, 191)
timeIt "magnifyBy2":
let minified = image.magnifyBy2()
doAssert minified[0, 0] == rgba(63, 127, 191, 191)
reset()
timeIt "invert":