From 2e4efefabb00a2136b47d4c35f6e7c4e2cff974e Mon Sep 17 00:00:00 2001
From: treeform <starplant@gmail.com>
Date: Thu, 5 May 2022 09:55:25 -0700
Subject: [PATCH] Add benchmarks.

---
 tests/benchmark_jpeg.nim | 45 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/tests/benchmark_jpeg.nim b/tests/benchmark_jpeg.nim
index 3bbe13e..0558438 100644
--- a/tests/benchmark_jpeg.nim
+++ b/tests/benchmark_jpeg.nim
@@ -1,6 +1,45 @@
 import benchy, pixie/fileformats/jpg
 
-let data = readFile("tests/fileformats/jpeg/jpeg420exif.jpg")
+var files = @[
+  "tests/fileformats/jpeg/master/red.jpg",
+  "tests/fileformats/jpeg/master/green.jpg",
+  "tests/fileformats/jpeg/master/blue.jpg",
+  "tests/fileformats/jpeg/master/white.jpg",
+  "tests/fileformats/jpeg/master/black.jpg",
 
-timeIt "pixie decode":
-  discard decodeJpg(data)
+  "tests/fileformats/jpeg/master/8x8.jpg",
+  "tests/fileformats/jpeg/master/8x8_progressive.jpg",
+
+  "tests/fileformats/jpeg/master/16x16.jpg",
+  "tests/fileformats/jpeg/master/16x16_progressive.jpg",
+
+  "tests/fileformats/jpeg/master/quality_01.jpg",
+  "tests/fileformats/jpeg/master/quality_10.jpg",
+  "tests/fileformats/jpeg/master/quality_25.jpg",
+  "tests/fileformats/jpeg/master/quality_50.jpg",
+  "tests/fileformats/jpeg/master/quality_100.jpg",
+
+  "tests/fileformats/jpeg/master/cat_4_4_4.jpg",
+  "tests/fileformats/jpeg/master/cat_4_4_4.jpg",
+  "tests/fileformats/jpeg/master/cat_4_2_2.jpg",
+  "tests/fileformats/jpeg/master/cat_4_2_0.jpg",
+  "tests/fileformats/jpeg/master/cat_4_1_1.jpg",
+  "tests/fileformats/jpeg/master/cat_4_4_4_progressive.jpg",
+  "tests/fileformats/jpeg/master/cat_restart_markers_5.jpg",
+  "tests/fileformats/jpeg/master/cat_restart_markers_5_progressive.jpg",
+
+  "tests/fileformats/jpeg/master/mandrill.jpg",
+  "tests/fileformats/jpeg/master/exif_overrun.jpg",
+  "tests/fileformats/jpeg/master/grayscale_test.jpg",
+  "tests/fileformats/jpeg/master/progressive.jpg",
+
+  "tests/fileformats/jpeg/master/testimg.jpg",
+  "tests/fileformats/jpeg/master/testimgp.jpg",
+  "tests/fileformats/jpeg/master/testorig.jpg",
+  "tests/fileformats/jpeg/master/testprog.jpg",
+]
+
+for file in files:
+  let data = readFile(file)
+  timeIt "jpeg " & $(len(data) div 1024) & "k decode":
+    discard decodeJpg(data)