diff --git a/tests/data/images/12_654_1580.png b/tests/data/images/12_654_1580.png new file mode 100644 index 000000000..0f15a353c Binary files /dev/null and b/tests/data/images/12_654_1580.png differ diff --git a/tests/python_tests/image_encoding_speed_test.py b/tests/python_tests/image_encoding_speed_test.py index 8050f3497..14a41bbe5 100644 --- a/tests/python_tests/image_encoding_speed_test.py +++ b/tests/python_tests/image_encoding_speed_test.py @@ -18,14 +18,23 @@ combinations = ['png', 'png8:m=h', 'png8:m=o:t=0', 'png8:m=o:t=1', + 'png8:m=o:t=2', 'png8:m=h:t=0', 'png8:m=h:t=1', + 'png8:m=h:t=2', 'png:z=1', 'png8:z=1', 'png8:z=1:m=o', 'png8:z=1:m=h', - 'png8:z=1:c=50', 'png8:z=1:c=1', + 'png8:z=1:c=24', + 'png8:z=1:c=64', + 'png8:z=1:c=128', + 'png8:z=1:c=200', + 'png8:z=1:c=255', + 'png8:z=9:c=64', + 'png8:z=9:c=128', + 'png8:z=9:c=200', 'png8:z=1:c=50:m=h', 'png8:z=1:c=1:m=o', 'png8:z=1:c=1:m=o:s=filtered', @@ -53,11 +62,11 @@ def do_encoding(): min_ = min(set)*1000 avg = (sum(set)/len(set))*1000 name = func.__name__ + ' ' + format - results[name] = [avg,min_,elapsed*1000,name] - sortable[name] = [avg] + results[name] = [avg,min_,elapsed*1000,name,len(func())] + sortable[name] = [min_] def blank(): - eval('image.tostring("%s")' % c) + return eval('image.tostring("%s")' % c) blank_im = mapnik.Image(512,512) for c in combinations: @@ -65,7 +74,7 @@ def do_encoding(): run(blank,blank_im,c,t) def solid(): - eval('image.tostring("%s")' % c) + return eval('image.tostring("%s")' % c) solid_im = mapnik.Image(512,512) solid_im.background = mapnik.Color("#f2efe9") @@ -74,7 +83,7 @@ def do_encoding(): run(solid,solid_im,c,t) def many_colors(): - eval('image.tostring("%s")' % c) + return eval('image.tostring("%s")' % c) # lots of colors: http://tile.osm.org/13/4194/2747.png many_colors_im = mapnik.Image.open('../data/images/13_4194_2747.png') @@ -82,13 +91,23 @@ def do_encoding(): t = Timer(many_colors) run(many_colors,many_colors_im,c,t) + def aerial_24(): + return eval('image.tostring("%s")' % c) + aerial_24_im = mapnik.Image.open('../data/images/12_654_1580.png') + + for c in combinations: + t = Timer(aerial_24) + run(aerial_24,aerial_24_im,c,t) + for key, value in sorted(sortable.iteritems(), key=lambda (k,v): (v,k)): s = results[key] avg = str(s[0])[:6] min_ = str(s[1])[:6] elapsed = str(s[2])[:6] + percent_reduction = s[4] name = s[3] - print 'avg: %sms | min: %sms | total: %sms <-- %s' % (min_,avg,elapsed,name) + size = s[4] + print 'avg: %sms | min: %sms | total: %sms | len: %s <-- %s' % (min_,avg,elapsed,size,name) if __name__ == "__main__":