forked from etemesi254/zune-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmark.sh
executable file
·66 lines (54 loc) · 1.87 KB
/
benchmark.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#
# Copyright (c) 2023.
#
# This software is free software; You can redistribute it or modify it under terms of the MIT, Apache License or Zlib license
#
#/bin/bash
echo "compiling zune-image"
cargo build --release --quiet
if ! command -v vips &> /dev/null
then
echo "VIPS command could not be found, ensure you have installed vips in the command line"
exit
else
echo "VIPS present"
fi
if ! command -v convert &> /dev/null
then
echo "Imagemagick convert command could not be found, ensure you have installed imagemagick in the command line"
exit
else
echo "Imagemagick present"
fi
if !command -v hyperfine &> /dev/null
then
echo "Hyperfine command not found see https://github.com/sharkdp/hyperfine for installation method"
else
echo "hyperfine command present"
fi
function jpeg_hdr() {
echo "Baseline jpeg to hdr"
IN_FILE="./test-images/jpeg/benchmarks/speed_bench.jpg"
output="$(mktemp --tmpdir result_XXXXXXXXXXXXX.hdr)"
echo ${IN_FILE};
hyperfine --warmup=5 "vips copy $IN_FILE $output" "./target/release/zune -i $IN_FILE -o $output" "convert $IN_FILE $output"
}
function png_jpeg() {
echo "Baseline png to jpeg"
IN_FILE="./test-images/png/benchmarks/speed_bench.png"
output="$(mktemp --tmpdir result_XXXXXXXXXXXXX.jpg)"
echo ${IN_FILE};
hyperfine --warmup=5 "vips copy $IN_FILE $output" "./target/release/zune -i $IN_FILE -o $output" "convert $IN_FILE $output"
}
function jpeg_jxl_lossless(){
echo "Baseline JPEG to JXL lossless"
# vips takes too long on this
#IN_FILE="./test-images/jpeg/benchmarks/speed_bench.jpg"
IN_FILE="./test-images/png/benchmarks/speed_bench.png"
output="$(mktemp --tmpdir result_XXXXXXXXXXXXX.jxl)"
echo ${IN_FILE};
hyperfine --warmup=5 "vips jxlsave $IN_FILE $output --lossless=true" "./target/release/zune -i $IN_FILE -o $output" "convert $IN_FILE $output"
}
jpeg_hdr
png_jpeg
jpeg_jxl_lossless