Skip to content

Commit ada2bcb

Browse files
committed
update for latest
1 parent 512b958 commit ada2bcb

File tree

4 files changed

+78
-70
lines changed

4 files changed

+78
-70
lines changed

benchmark.sh

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ mkdir $tmp
99

1010
echo building test image ...
1111
vips colourspace sample2.v $tmp/t1.v srgb
12-
vips replicate $tmp/t1.v $tmp/t2.v 20 15
13-
vips extract_area $tmp/t2.v $tmp/x.tif[tile] 0 0 5000 5000
12+
#vips replicate $tmp/t1.v $tmp/t2.v 20 15
13+
vips replicate $tmp/t1.v $tmp/t2.v 40 30
14+
vips extract_area $tmp/t2.v $tmp/x.tif[tile] 0 0 10000 10000
1415
vips copy $tmp/x.tif $tmp/x.jpg
1516
vips copy $tmp/x.tif $tmp/x.ppm
1617
vips copy $tmp/x.tif $tmp/x-strip.tif
@@ -87,15 +88,17 @@ rm -f *.csv
8788

8889
echo "program, time (s), peak memory (MB)"
8990

90-
benchmark tiffcp "tiffcp -s $tmp/x.tif $tmp/x2.tif"
91-
92-
gcc -Wall vips.c `pkg-config vips --cflags --libs` -o vips-c
93-
benchmark vips-c "./vips-c $tmp/x.tif $tmp/x2.tif"
91+
export VIPS_CONCURRENCY=16
9492

9593
gcc -Wall vips.c `pkg-config vips --cflags --libs` -o vips-c
9694
echo -n ppm-
9795
benchmark vips-c "./vips-c $tmp/x.ppm $tmp/x2.ppm"
9896

97+
benchmark tiffcp "tiffcp -s $tmp/x.tif $tmp/x2.tif"
98+
99+
gcc -Wall vips.c `pkg-config vips --cflags --libs` -o vips-c
100+
benchmark vips-c "./vips-c $tmp/x.tif $tmp/x2.tif"
101+
99102
benchmark vips.lua "./vips.lua $tmp/x.tif $tmp/x2.tif"
100103

101104
benchmark vips.php "./vips.php $tmp/x.tif $tmp/x2.tif"
@@ -107,6 +110,14 @@ benchmark vips.py "./vips.py $tmp/x.tif $tmp/x2.tif"
107110

108111
benchmark ruby-vips "./ruby-vips.rb $tmp/x.tif $tmp/x2.tif"
109112

113+
benchmark vips-gegl.py "./vips-gegl.py $tmp/x.tif $tmp/x2.tif"
114+
115+
gcc -Wall vips.c `pkg-config vips --cflags --libs` -o vips-c
116+
export VIPS_CONCURRENCY=1
117+
echo -n 1thread-
118+
benchmark vips-c "./vips-c $tmp/x.tif $tmp/x2.tif"
119+
unset VIPS_CONCURRENCY
120+
110121
gcc -Wall vips.c `pkg-config vips --cflags --libs` -o vips-c
111122
echo -n jpg-
112123
benchmark vips-c "./vips-c $tmp/x.jpg $tmp/x2.jpg"
@@ -115,9 +126,8 @@ benchmark pillow "./pillow.py $tmp/x-strip.tif $tmp/x2.tif"
115126

116127
benchmark vips "./vips.sh $tmp/x.tif $tmp/x2.tif"
117128

118-
benchmark vips.js "./vips.js $tmp/x.tif $tmp/x2.tif"
119-
120-
benchmark vips-gegl.py "./vips-gegl.py $tmp/x.tif $tmp/x2.tif"
129+
# sadly bitrotted in the shifting sands of node
130+
# benchmark vips.js "./vips.js $tmp/x.tif $tmp/x2.tif"
121131

122132
echo -n ppm-
123133
benchmark gm "./gm.sh $tmp/x.ppm $tmp/x2.ppm"
@@ -137,12 +147,6 @@ benchmark pnm "./netpbm.sh $tmp/x-strip.tif $tmp/x2.tif"
137147

138148
benchmark rmagick "./rmagick.rb $tmp/x.tif $tmp/x2.tif"
139149

140-
gcc -Wall vips.c `pkg-config vips --cflags --libs` -o vips-c
141-
export VIPS_CONCURRENCY=1
142-
echo -n 1thread-
143-
benchmark vips-c "./vips-c $tmp/x.tif $tmp/x2.tif"
144-
unset VIPS_CONCURRENCY
145-
146150
# this needs careful config, see
147151
# https://github.com/jcupitt/vips-bench/issues/4
148152
YMAGINE=/home/john/ymagine
@@ -163,36 +167,33 @@ benchmark convert "./im.sh $tmp/x.tif $tmp/x2.tif"
163167

164168
benchmark imwand.py "./imwand.py $tmp/x.tif $tmp/x2.tif"
165169

166-
benchmark econvert "./ei.sh $tmp/x-strip.tif $tmp/x2.tif"
167-
168170
echo -n jpg-
169171
benchmark convert "./im.sh $tmp/x.jpg $tmp/x2.jpg"
170172

171-
g++ -g -Wall opencv.cc `pkg-config opencv --cflags --libs` -o opencv
173+
g++ -g -Wall opencv.cc `pkg-config opencv4 --cflags --libs` -o opencv
172174
benchmark opencv "./opencv $tmp/x.tif $tmp/x2.tif"
173175

176+
benchmark oiio "./oiio.sh $tmp/x.tif $tmp/x2.tif"
177+
178+
benchmark imagej "imagej -x 1000 -i $tmp/x-strip.tif -b bench.ijm"
179+
180+
benchmark econvert "./ei.sh $tmp/x-strip.tif $tmp/x2.tif"
181+
174182
gcc -Wall imlib2.c `pkg-config imlib2 --cflags --libs` -o imlib2
175183
benchmark imlib2 "./imlib2 $tmp/x.tif $tmp/x2.tif"
176184

177185
gcc freeimage.c -lfreeimage -o freeimage
178186
benchmark freeimage "./freeimage $tmp/x-strip.tif $tmp/x2.tif"
179187

180-
benchmark oiio "./oiio.sh $tmp/x.tif $tmp/x2.tif"
181-
182-
benchmark is "./is.rb $tmp/x-strip.tif $tmp/x2.tif"
188+
# broken, again, in ruby 2.7
189+
# benchmark is "./is.rb $tmp/x-strip.tif $tmp/x2.tif"
183190

184191
gcc -Wall gd.c `pkg-config gdlib --cflags --libs` -o gd
185192
echo -n jpg-
186193
benchmark gd "./gd $tmp/x.jpg $tmp/x2.jpg"
187194

188195
benchmark imagick "./imagick.php $tmp/x.tif $tmp/x2.tif"
189196

190-
benchmark pike "./image.pike $tmp/x.tif $tmp/x2.tif"
191-
192-
benchmark gmic "./gmic.sh $tmp/x.tif $tmp/x2.tif"
193-
194-
benchmark imagej "imagej -x 1000 -i $tmp/x-strip.tif -b bench.ijm"
195-
196197
gcc -Wall gegl.c `pkg-config gegl-0.4 --cflags --libs` -o gegl
197198
# gegl-0.4 doesn't have tiff support built in
198199
# echo -n tiff-
@@ -201,8 +202,12 @@ gcc -Wall gegl.c `pkg-config gegl-0.4 --cflags --libs` -o gegl
201202
echo -n jpg-
202203
benchmark gegl "./gegl $tmp/x.jpg $tmp/x2.jpg"
203204

205+
benchmark pike "./image.pike $tmp/x.tif $tmp/x2.tif"
206+
207+
benchmark gmic "./gmic.sh $tmp/x.tif $tmp/x2.tif"
208+
204209
# this has stopped working and needs fixing
205-
benchmark scikit "./scikit.py $tmp/x-strip.tif $tmp/x2.tif"
210+
# benchmark scikit "./scikit.py $tmp/x-strip.tif $tmp/x2.tif"
206211

207212
benchmark octave "./octave.m $tmp/x.tif $tmp/x2.tif"
208213

parse-ps.rb

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,50 @@
33
# watch the output of ps, sum RSS of processes matching a pattern and output
44
# time and size in MB
55

6-
require 'csv'
76
require 'set'
87

98
program = ARGV[0]
10-
units = { 'm' => 2, 'g' => 3 }
9+
units = { 'm': 2, 'g': 3 }
1110

12-
puts ",#{program},"
13-
puts "0,0,0"
14-
15-
page_total = 0
11+
start_time = Time.now
12+
page_memory = 0
1613
peak_memory = 0
17-
start_time = 0
18-
19-
CSV($stdin, :col_sep => " ") do |csv_in|
20-
csv_in.each do |row|
21-
if row[0] =~ /USER/
22-
if page_total > 1
23-
start_time = Time.now if start_time == 0
24-
peak_memory = [peak_memory, page_total].max
25-
puts "#{Time.now - start_time}, #{page_total}, #{peak_memory}"
26-
end
27-
page_total = 0
28-
next
29-
end
30-
31-
next if not row[10 .. -1].join =~ /#{program}/
32-
33-
# we need to not count ourselves
34-
next if row[10 .. -1].join =~ /parse-ps/
35-
36-
memstr = row[5]
37-
38-
if memstr !~ /([0-9]+)([kmg]?)/
39-
puts "bad memory size #{memstr}"
40-
next
41-
end
42-
mem = $~[1].to_i * 1024
43-
unit = $~[2]
44-
mem *= (2 ** 10) ** units[unit] if units[unit]
45-
mem /= (2 ** 10.to_f) ** 2
46-
47-
page_total += mem
14+
trace = []
15+
16+
$stdin.each do |line|
17+
row = line.split
18+
prg = row[10 .. -1].join
19+
memstr = row[5]
20+
21+
if row[0] =~ /USER/
22+
peak_memory = [peak_memory, page_memory].max
23+
trace << [Time.now - start_time, page_memory, peak_memory]
24+
page_memory = 0
25+
next
26+
end
27+
28+
next if not prg =~ /#{program}/
29+
30+
# we need to not count ourselves
31+
next if prg =~ /parse-ps/
32+
33+
if memstr !~ /([0-9]+)([kmg]?)/
34+
puts "bad memory size #{memstr}"
35+
next
4836
end
37+
mem = $~[1].to_i * 1024
38+
unit = $~[2]
39+
mem *= (2 ** 10) ** units[unit] if units[unit]
40+
mem /= (2 ** 10.to_f) ** 2
41+
42+
page_memory += mem
4943
end
5044

51-
start_time = Time.now if start_time == 0
52-
puts "#{Time.now - start_time}, 0, #{peak_memory}"
45+
peak_memory = [peak_memory, page_memory].max
46+
trace << [Time.now - start_time, page_memory, peak_memory]
47+
trace << [Time.now - start_time, 0, peak_memory]
48+
49+
puts ",#{program},"
50+
trace.each do |time, mem, peak|
51+
puts "#{time.round(2)}, #{mem}, #{peak}"
52+
end

pillow.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import sys
44
from PIL import Image, ImageFilter, __version__
55

6+
Image.MAX_IMAGE_PIXELS = None
7+
68
# just to confirm we are getting the right version
7-
print 'pillow.py: __version__ =', __version__
9+
print(f'pillow.py: __version__ = {__version__}')
810

911
im = Image.open(sys.argv[1])
1012
width, height = im.size

scikit.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
import numpy as np
55
from scipy import ndimage, misc
66
from PIL import Image
7+
import imageio
78

8-
im = ndimage.imread(sys.argv[1])
9+
im = imageio.imread(sys.argv[1])
910

1011
width, height, bands = im.shape
1112
im = im[100:(width - 100), 100:(height - 100)]

0 commit comments

Comments
 (0)