de-flake GradientLinear angular, bench_jpeg.

This commit is contained in:
treeform 2022-07-10 12:48:06 -07:00
parent 8bc78c939b
commit a076a86dd7
3 changed files with 59 additions and 5 deletions

View file

@ -1,10 +1,61 @@
import benchy, pixie/fileformats/jpeg, jpegsuite, os import benchy, pixie/fileformats/jpeg, os
for file in jpegSuiteFiles: const
jpegFiles* = [
(100, "tests/fileformats/jpeg/masters/red.jpg"),
(100, "tests/fileformats/jpeg/masters/green.jpg"),
(100, "tests/fileformats/jpeg/masters/blue.jpg"),
(100, "tests/fileformats/jpeg/masters/white.jpg"),
(100, "tests/fileformats/jpeg/masters/black.jpg"),
(100, "tests/fileformats/jpeg/masters/8x8.jpg"),
(100, "tests/fileformats/jpeg/masters/8x8_progressive.jpg"),
(20, "tests/fileformats/jpeg/masters/16x16.jpg"),
(20, "tests/fileformats/jpeg/masters/16x16_progressive.jpg"),
(10, "tests/fileformats/jpeg/masters/f1-exif.jpg"),
(10, "tests/fileformats/jpeg/masters/f2-exif.jpg"),
(10, "tests/fileformats/jpeg/masters/f3-exif.jpg"),
(10, "tests/fileformats/jpeg/masters/f4-exif.jpg"),
(10, "tests/fileformats/jpeg/masters/f5-exif.jpg"),
(10, "tests/fileformats/jpeg/masters/f6-exif.jpg"),
(10, "tests/fileformats/jpeg/masters/f7-exif.jpg"),
(10, "tests/fileformats/jpeg/masters/f8-exif.jpg"),
(1, "tests/fileformats/jpeg/masters/quality_01.jpg"),
(1, "tests/fileformats/jpeg/masters/quality_10.jpg"),
(1, "tests/fileformats/jpeg/masters/quality_25.jpg"),
(1, "tests/fileformats/jpeg/masters/quality_50.jpg"),
(1, "tests/fileformats/jpeg/masters/quality_100.jpg"),
(1, "tests/fileformats/jpeg/masters/cat_4_4_4.jpg"),
(1, "tests/fileformats/jpeg/masters/cat_4_4_4.jpg"),
(1, "tests/fileformats/jpeg/masters/cat_4_2_2.jpg"),
(1, "tests/fileformats/jpeg/masters/cat_4_2_0.jpg"),
(1, "tests/fileformats/jpeg/masters/cat_4_1_1.jpg"),
(1, "tests/fileformats/jpeg/masters/cat_4_2_0_progressive.jpg"),
(1, "tests/fileformats/jpeg/masters/cat_4_4_4_progressive.jpg"),
(1, "tests/fileformats/jpeg/masters/cat_restart_markers_5.jpg"),
(1, "tests/fileformats/jpeg/masters/cat_restart_markers_5_progressive.jpg"),
(1, "tests/fileformats/jpeg/masters/mandrill.jpg"),
(1, "tests/fileformats/jpeg/masters/exif_overrun.jpg"),
(1, "tests/fileformats/jpeg/masters/grayscale_test.jpg"),
(1, "tests/fileformats/jpeg/masters/progressive.jpg"),
(1, "tests/fileformats/jpeg/masters/testimg.jpg"),
(1, "tests/fileformats/jpeg/masters/testimgp.jpg"),
(1, "tests/fileformats/jpeg/masters/testorig.jpg"),
(1, "tests/fileformats/jpeg/masters/testprog.jpg"),
]
for (times, file) in jpegFiles:
let data = readFile(file) let data = readFile(file)
timeIt "pixie " & file.splitPath.tail & " decode": timeIt "pixie " & file.splitPath.tail & " decode":
discard decodeJpeg(data) for i in 0 ..< times:
discard decodeJpeg(data)
# import stb_image/read as stbi # import stb_image/read as stbi
# block: # block:

View file

@ -29,6 +29,8 @@ timeIt "GradientLinear horizontal":
# timeIt "GradientLinear radial": # timeIt "GradientLinear radial":
# discard # discard
let image100 = newImage(100, 100)
timeIt "GradientLinear angular": timeIt "GradientLinear angular":
let paint = newPaint(AngularGradientPaint) let paint = newPaint(AngularGradientPaint)
paint.gradientHandlePositions = @[ paint.gradientHandlePositions = @[
@ -40,4 +42,4 @@ timeIt "GradientLinear angular":
ColorStop(color: color(1, 0, 0, 1), position: 0), ColorStop(color: color(1, 0, 0, 1), position: 0),
ColorStop(color: color(1, 0, 0, 0.15625), position: 1.0), ColorStop(color: color(1, 0, 0, 0.15625), position: 1.0),
] ]
image.fillGradient(paint) image100.fillGradient(paint)

View file

@ -1,3 +1,4 @@
const jpegSuiteFiles* = [ const jpegSuiteFiles* = [
"tests/fileformats/jpeg/masters/red.jpg", "tests/fileformats/jpeg/masters/red.jpg",
"tests/fileformats/jpeg/masters/green.jpg", "tests/fileformats/jpeg/masters/green.jpg",