Skip to content

Commit

Permalink
Update benchmark scripts; ensure they all specify jpeg output quality…
Browse files Browse the repository at this point in the history
…. Add bench3 for comparative between flow-proto1, imageflow_tool, and vipsthumbnail
  • Loading branch information
lilith committed Aug 5, 2017
1 parent 9e0b6e2 commit 98bc671
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 29 deletions.
28 changes: 12 additions & 16 deletions imageflow_tool/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ echo
echo on OS X, you will need to edit this script to use time instead of perf stat
echo And run brew install parallel

#-limit thread 1

RUSTFLAGS="-C target-cpu=native" cargo build --release
cp target/release/flow-proto1 .
./build_release_tool.sh

convert --version
./flow-proto1 --version
vipsthumbnail --vips-version


Expand Down Expand Up @@ -53,55 +49,55 @@ fi
cd bench_in || exit

echo Using imageflow to thumbnail $COUNT images in parallel
$TIME_COMMAND parallel '../flow-proto1 -i {} -o ../bench_out/{.}_200x200.jpg -w 200 -h 200' ::: *.jpg
$TIME_COMMAND parallel '../flow-proto1 -i {} -o ../bench_out/{.}_200x200.jpg -w 200 -h 200 --jpeg-quality 90' ::: *.jpg
echo
echo
echo Using libvips to thumbnail $COUNT images in parallel
$TIME_COMMAND parallel 'vipsthumbnail --linear --size=200x200 --output=../bench_out/{.}_vips_200x200.jpg {}' ::: *.jpg
$TIME_COMMAND parallel 'vipsthumbnail --linear --size=200x200 --output=../bench_out/{.}_vips_200x200.jpg[Q=90] {}' ::: *.jpg

echo
echo
echo Using ImageMagick to thumbnail $COUNT images in parallel
$TIME_COMMAND parallel 'convert {} -set colorspace sRGB -colorspace RGB -filter Robidoux -resize 200x200 -colorspace sRGB ../bench_out/{.}_magick_200x200.jpg' ::: *.jpg
$TIME_COMMAND parallel 'convert {} -set colorspace sRGB -colorspace RGB -filter Robidoux -resize 200x200 -colorspace sRGB -quality 90 ../bench_out/{.}_magick_200x200.jpg' ::: *.jpg

echo
echo
echo Using ImageMagick ideal settings to thumbnail $COUNT images in parallel
$TIME_COMMAND parallel 'convert {} -set colorspace sRGB -colorspace RGB -filter Mitchell -distort Resize 200x200 -colorspace sRGB ../bench_out/{.}_magick_ideal_200x200.jpg' ::: *.jpg
$TIME_COMMAND parallel 'convert {} -set colorspace sRGB -colorspace RGB -filter Mitchell -distort Resize 200x200 -colorspace sRGB -quality 90 ../bench_out/{.}_magick_ideal_200x200.jpg' ::: *.jpg


echo
echo
echo Using imageflow to create 2000px versions of $COUNT images in parallel
$TIME_COMMAND parallel '../flow-proto1 -i {} -o ../bench_out/{.}_2000x2000.jpg -w 2000 -h 2000' ::: *.jpg
$TIME_COMMAND parallel '../flow-proto1 -i {} -o ../bench_out/{.}_2000x2000.jpg -w 2000 -h 2000 --jpeg-quality 90' ::: *.jpg
echo
echo
echo Using libvips to create 2000px versions of $COUNT images in parallel
$TIME_COMMAND parallel 'vipsthumbnail --linear --size=2000x2000 --output=../bench_out/{.}_vips_2000x2000.jpg {}' ::: *.jpg
$TIME_COMMAND parallel 'vipsthumbnail --linear --size=2000x2000 --output=../bench_out/{.}_vips_2000x2000.jpg[Q=90] {}' ::: *.jpg

echo
echo
echo Using ImageMagick to create 2000px versions of $COUNT images in parallel
$TIME_COMMAND parallel 'convert {} -set colorspace sRGB -colorspace RGB -filter Robidoux -resize 2000x2000 -colorspace sRGB ../bench_out/{.}_magick_2000x2000.jpg' ::: *.jpg
$TIME_COMMAND parallel 'convert {} -set colorspace sRGB -colorspace RGB -filter Robidoux -resize 2000x2000 -colorspace sRGB -quality 90 ../bench_out/{.}_magick_2000x2000.jpg' ::: *.jpg

echo
echo
echo Using ImageMagick ideal settings to create 2000px versions of COUNT images in parallel
$TIME_COMMAND parallel 'convert {} -set colorspace sRGB -colorspace RGB -filter Mitchell -distort Resize 2000x2000 -colorspace sRGB ../bench_out/{.}_magick_ideal_2000x2000.jpg' ::: *.jpg
$TIME_COMMAND parallel 'convert {} -set colorspace sRGB -colorspace RGB -filter Mitchell -distort Resize 2000x2000 -colorspace sRGB -quality 90 ../bench_out/{.}_magick_ideal_2000x2000.jpg' ::: *.jpg


echo
echo
echo Using imageflow wrong on $COUNT images in parallel. 200x200
$TIME_COMMAND parallel '../flow-proto1 -i {} --incorrectgamma -o ../bench_out/{.}_200x200_wrong.jpg -w 200 -h 200' ::: *.jpg
$TIME_COMMAND parallel '../flow-proto1 -i {} --incorrectgamma -o ../bench_out/{.}_200x200_wrong.jpg -w 200 -h 200 --jpeg-quality 90' ::: *.jpg
echo
echo
echo Using libvips wrong on $COUNT images in parallel. 200x200
$TIME_COMMAND parallel 'vipsthumbnail --size=200x200 --output=../bench_out/{.}_vips_200x200_wrong.jpg {}' ::: *.jpg
$TIME_COMMAND parallel 'vipsthumbnail --size=200x200 --output=../bench_out/{.}_vips_200x200_wrong.jpg[Q=90] {}' ::: *.jpg

echo
echo
echo Using ImageMagick wrong on $COUNT images in parallel. 200x200
$TIME_COMMAND parallel 'convert {} -filter Robidoux -resize 200x200 ../bench_out/{.}_magick_200x200_wrong.jpg' ::: *.jpg
$TIME_COMMAND parallel 'convert {} -filter Robidoux -resize 200x200 -quality 90 ../bench_out/{.}_magick_200x200_wrong.jpg' ::: *.jpg

)
5 changes: 1 addition & 4 deletions imageflow_tool/bench2.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/bin/bash

cargo build --release
cp ../target/release/flow-proto1 .

./flow-proto1 --version
./build_release_tool.sh

wget -nc https://s3-us-west-2.amazonaws.com/imageflow-resources/test_inputs/u1.jpg

Expand Down
42 changes: 42 additions & 0 deletions imageflow_tool/bench3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

./build_release_tool.sh

vipsthumbnail --vips-version

wget -nc https://s3-us-west-2.amazonaws.com/imageflow-resources/test_inputs/u1.jpg

mkdir bench_out
mkdir bench_in
rm bench_out/*.jpg
rm bench_in/*.jpg

export COUNT=8

for i in $(seq 1 $COUNT);
do
cp "u1.jpg" "bench_in/c$i.jpg"
done

if [[ "$OSTYPE" == "linux-gnu" ]]; then
export TIME_COMMAND="perf stat"
else
export TIME_COMMAND=time
fi

(
cd bench_in || exit
#
echo Using flow-proto1 to thumbnail $COUNT images in parallel
$TIME_COMMAND parallel '../flow-proto1 --min_precise_scaling_ratio 1 -i {} -o ../bench_out/{.}_200x200.jpg -w 200 -h 200 --jpeg-quality 65 --format jpg' ::: *.jpg
#
echo
echo
echo Using imageflow_tool to thumbnail $COUNT images in parallel
$TIME_COMMAND parallel '../imageflow_tool v0.1/ir4 --in {} --out ../bench_out/{.}_200x200.jpg --command "maxwidth=200&maxheight=200&quality=65&format=jpg" > /dev/null' ::: *.jpg
#
echo
echo
echo Using libvips to thumbnail $COUNT images in parallel
$TIME_COMMAND parallel 'vipsthumbnail --linear --size=200x200 --format=jpg --output=../bench_out/{.}_vips_200x200.jpg[Q=65] {}' ::: *.jpg
)
16 changes: 7 additions & 9 deletions imageflow_tool/bench_single_thread.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ echo and sudo apt-get install linux-tools-common linux-tools-generic
echo
echo on OS X, you will need to edit this script to use time instead of perf stat

cargo build --release
cp target/release/flow-proto1 .
./build_release_tool.sh

convert --version
./flow-proto1 --version
vipsthumbnail --vips-version


Expand Down Expand Up @@ -48,16 +46,16 @@ export IMAGE_PATH=c1.jpg
cd bench_in || exit

echo Using imageflow to thumbnail
$TIME_COMMAND ../flow-proto1 -i $IMAGE_PATH -o ../bench_out/1_200x200.jpg -w 200 -h 200
$MEM_COMMAND ../flow-proto1 -i $IMAGE_PATH -o ../bench_out/1_200x200.jpg -w 200 -h 200
$TIME_COMMAND ../flow-proto1 -i $IMAGE_PATH -o ../bench_out/1_200x200.jpg -w 200 -h 200 --jpeg-quality 90
$MEM_COMMAND ../flow-proto1 -i $IMAGE_PATH -o ../bench_out/1_200x200.jpg -w 200 -h 200 --jpeg-quality 90
echo
echo
echo Using libvips to thumbnail
$TIME_COMMAND vipsthumbnail --linear --size=200x200 --output=../bench_out/1_vips_200x200.jpg $IMAGE_PATH
$MEM_COMMAND vipsthumbnail --linear --size=200x200 --output=../bench_out/1_vips_200x200.jpg $IMAGE_PATH
$TIME_COMMAND vipsthumbnail --linear --size=200x200 --output=../bench_out/1_vips_200x200.jpg[Q=90] $IMAGE_PATH
$MEM_COMMAND vipsthumbnail --linear --size=200x200 --output=../bench_out/1_vips_200x200.jpg[Q=90] $IMAGE_PATH

echo
echo
echo Using ImageMagick to thumbnail
$TIME_COMMAND convert $IMAGE_PATH -limit thread 1 -set colorspace sRGB -colorspace RGB -filter Robidoux -resize 200x200 -colorspace sRGB ../bench_out/1_magick_200x200.jpg
$MEM_COMMAND convert $IMAGE_PATH -limit thread 1 -set colorspace sRGB -colorspace RGB -filter Robidoux -resize 200x200 -colorspace sRGB ../bench_out/1_magick_200x200.jpg
$TIME_COMMAND convert $IMAGE_PATH -limit thread 1 -set colorspace sRGB -colorspace RGB -filter Robidoux -resize 200x200 -colorspace sRGB -quality 90 ../bench_out/1_magick_200x200.jpg
$MEM_COMMAND convert $IMAGE_PATH -limit thread 1 -set colorspace sRGB -colorspace RGB -filter Robidoux -resize 200x200 -colorspace sRGB -quality 90 ../bench_out/1_magick_200x200.jpg
7 changes: 7 additions & 0 deletions imageflow_tool/build_release_tool.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

RUSTFLAGS="-C target-cpu=native" CARGO_INCREMENTAL=1 cargo build --release
cp ../target/release/flow-proto1 .
./flow-proto1 --version
cp ../target/release/imageflow_tool .
./imageflow_tool --version

0 comments on commit 98bc671

Please sign in to comment.