Merge pull request #474 from treeform/guzba

deflake tests
This commit is contained in:
Andre von Houck 2022-07-24 09:54:09 -07:00 committed by GitHub
commit 0e30475699
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 81 deletions

View file

@ -1,27 +1,5 @@
import benchy, chroma, pixie, random, vmath import benchy, chroma, pixie, random, vmath
block:
let
a = newImage(1000, 1000)
b = newImage(50, 50)
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))
timeIt "small-on-big NormalBlend":
a.draw(b, translate(vec2(25, 25)), NormalBlend)
keep(b)
block:
let
a = newImage(1000, 1000)
b = newImage(50, 50)
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))
timeIt "small-on-big Smooth NormalBlend":
a.draw(b, translate(vec2(25.2, 25.2)), NormalBlend)
keep(b)
block: block:
let let
a = newImage(1000, 1000) a = newImage(1000, 1000)

View file

@ -1,70 +1,71 @@
import benchy, pixie import benchy, pixie
let mask = newMask(2560, 1440) block:
let mask = newMask(2560, 1440)
proc reset() = proc reset() =
mask.fill(63) mask.fill(63)
reset() reset()
timeIt "minifyBy2": timeIt "minifyBy2":
let minified = mask.minifyBy2() let minified = mask.minifyBy2()
doAssert minified[0, 0] == 63 doAssert minified[0, 0] == 63
reset() reset()
timeIt "magnifyBy2": timeIt "magnifyBy2":
let magnified = mask.magnifyBy2() let magnified = mask.magnifyBy2()
doAssert magnified[0, 0] == 63 doAssert magnified[0, 0] == 63
reset() reset()
timeIt "invert": timeIt "invert":
mask.invert() mask.invert()
reset() reset()
timeIt "applyOpacity": timeIt "applyOpacity":
reset() reset()
mask.applyOpacity(0.5) mask.applyOpacity(0.5)
reset() reset()
timeIt "blur": timeIt "ceil":
mask.blur(40)
reset()
timeIt "ceil":
mask.ceil() mask.ceil()
reset() block:
let mask = newMask(400, 400)
mask.fill(63)
block spread_1: timeIt "blur":
mask.blur(12)
block spread_1:
let p = newPath() let p = newPath()
p.rect(500, 500, 500, 500) p.rect(100, 100, 200, 200)
timeIt "spread_1": timeIt "spread_1":
mask.fill(0) mask.fill(0)
mask.fillPath(p) mask.fillPath(p)
mask.spread(10) mask.spread(5)
block spread_2: block spread_2:
let p = newPath() let p = newPath()
p.rect(500, 500, 1000, 1000) p.rect(100, 100, 200, 200)
timeIt "spread_2": timeIt "spread_2":
mask.fill(0) mask.fill(0)
mask.fillPath(p) mask.fillPath(p)
mask.spread(10) mask.spread(10)
block spread_3: block spread_3:
timeIt "spread_3": timeIt "spread_3":
mask.fill(255) mask.fill(255)
mask.spread(10) mask.spread(10)
block spread_4: block spread_4:
timeIt "spread_4": timeIt "spread_4":
mask.fill(0) mask.fill(0)
mask.unsafe[1000, 1000] = 255 mask.unsafe[200, 200] = 255
mask.spread(10) mask.spread(5)