From a6b2f70249b8a2c1421bb288c9d523a8b8a7a194 Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Sat, 28 Nov 2020 17:59:46 -0600 Subject: [PATCH] add jpg benchmark --- tests/benchmark_jpg.nim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/benchmark_jpg.nim diff --git a/tests/benchmark_jpg.nim b/tests/benchmark_jpg.nim new file mode 100644 index 0000000..df40317 --- /dev/null +++ b/tests/benchmark_jpg.nim @@ -0,0 +1,14 @@ +import pixie/fileformats/jpg, pixie/fileformats/stb_image/stb_image, fidget/opengl/perf + +let data = readFile("tests/images/jpg/jpeg420exif.jpg") + +timeIt "pixie decode": + for i in 0 ..< 20: + discard decodeJpg(cast[seq[uint8]](data)) + +timeIt "stb_image decode": + for i in 0 ..< 20: + var + width: int + height: int + discard loadFromMemory(cast[seq[uint8]](data), width, height)