From a076a86dd7a8e4f8f4dfb1f27c16fb9a9fd72041 Mon Sep 17 00:00:00 2001 From: treeform Date: Sun, 10 Jul 2022 12:48:06 -0700 Subject: [PATCH] de-flake GradientLinear angular, bench_jpeg. --- tests/bench_jpeg.nim | 59 +++++++++++++++++++++++++++++++++++++++--- tests/bench_paints.nim | 4 ++- tests/jpegsuite.nim | 1 + 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/tests/bench_jpeg.nim b/tests/bench_jpeg.nim index 99ab2b9..52d65a3 100644 --- a/tests/bench_jpeg.nim +++ b/tests/bench_jpeg.nim @@ -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) - timeIt "pixie " & file.splitPath.tail & " decode": - discard decodeJpeg(data) + for i in 0 ..< times: + discard decodeJpeg(data) + # import stb_image/read as stbi # block: diff --git a/tests/bench_paints.nim b/tests/bench_paints.nim index 5cf7411..8eea4b3 100644 --- a/tests/bench_paints.nim +++ b/tests/bench_paints.nim @@ -29,6 +29,8 @@ timeIt "GradientLinear horizontal": # timeIt "GradientLinear radial": # discard +let image100 = newImage(100, 100) + timeIt "GradientLinear angular": let paint = newPaint(AngularGradientPaint) paint.gradientHandlePositions = @[ @@ -40,4 +42,4 @@ timeIt "GradientLinear angular": ColorStop(color: color(1, 0, 0, 1), position: 0), ColorStop(color: color(1, 0, 0, 0.15625), position: 1.0), ] - image.fillGradient(paint) + image100.fillGradient(paint) diff --git a/tests/jpegsuite.nim b/tests/jpegsuite.nim index c073954..f31fc73 100644 --- a/tests/jpegsuite.nim +++ b/tests/jpegsuite.nim @@ -1,3 +1,4 @@ + const jpegSuiteFiles* = [ "tests/fileformats/jpeg/masters/red.jpg", "tests/fileformats/jpeg/masters/green.jpg",