pixie/tests/bench_jpeg.nim

31 lines
805 B
Nim
Raw Normal View History

import benchy, pixie/fileformats/jpeg, os
2020-11-28 23:59:46 +00:00
const
jpegFiles* = [
2022-07-10 22:49:50 +00:00
"tests/fileformats/jpeg/masters/mandrill.jpg",
"tests/fileformats/jpeg/masters/exif_overrun.jpg",
"tests/fileformats/jpeg/masters/grayscale_test.jpg",
"tests/fileformats/jpeg/masters/progressive.jpg"
]
2022-07-10 22:49:50 +00:00
for file in jpegFiles:
let data = readFile(file)
2022-07-10 07:02:27 +00:00
timeIt "pixie " & file.splitPath.tail & " decode":
2022-07-10 22:49:50 +00:00
discard decodeJpeg(data)
2022-07-10 18:12:45 +00:00
# import stb_image/read as stbi
# block:
2022-07-10 22:49:50 +00:00
# for file in jpegFiles:
2022-07-10 18:12:45 +00:00
# let data = readFile(file)
# var name = file.splitPath.tail
2022-07-10 18:12:45 +00:00
# timeIt "stb " & file.splitPath.tail & " decode":
# var width, height, channels: int
# discard loadFromMemory(
# cast[seq[byte]](data),
# width,
# height,
# channels,
# stbi.RGBA
# )