SVG benchmarks/test 20090816

Scripts
This differs only in a few aspects from David Gerard's tests. Output files were written to distinct directories named after the programm used following the pattern $BASEDIR/svg/test.svg -> $BASEDIR/prog/test.png Test results were gathered in a file

The main difference is the use of User:Ktims batikd http server. See scripts below.

The system was an AMD Athlon XP 2000+ with Ubuntu 8.04, 757.1 MiB memory, X running in Failsafe.

Benchmark script
svgbench.sh:

export BASEDIR=/home/claus/Grafik/commons/svg/PNGs export SVGDIR=$BASEDIR/svg export SCRDIR=$BASEDIR/scripts export WIDTH=600 /usr/bin/time --format 'ImageMagick %e\t%U\t%S' -a --output=$SCRDIR/times $SCRDIR/imb.sh /usr/bin/time --format 'Inkscape   %e\t%U\t%S' -a --output=$SCRDIR/times $SCRDIR/inkscape.sh /usr/bin/time --format 'Batik       %e\t%U\t%S' -a --output=$SCRDIR/times $SCRDIR/batik.sh /usr/bin/time --format 'rsvg        %e\t%U\t%S' -a --output=$SCRDIR/times $SCRDIR/rsvg.sh echo "" >> scripts/times
 * 1) !/bin/bash

Batik harness
The Batik server was run with resulting in the command classpath=bin:ext/simple.jar:ext/batik-anim.jar:ext/batik-awt-util.jar:ext/batik-bridge.jar:ext/batik-codec.jar:ext/batik-css.jar:ext/batik-dom.jar:ext/batik-extension.jar:ext/batik-ext.jar:ext/batik-gui-util.jar:ext/batik-gvt.jar:ext/batik-parser.jar:ext/batik-script.jar:ext/batik-svggen.jar:ext/batik-svg-dom.jar:ext/batik-swing.jar:ext/batik-transcoder.jar:ext/batik-util.jar:ext/batik-xml.jar:ext/js.jar:ext/pdf-transcoder.jar:ext/xalan-2.6.0.jar:ext/xerces_2_5_0.jar:ext/xml-apis-ext.jar:ext/xml-apis.jar mainClass=org.ktims.batikd.BatikServer exec java -Djava.security.manager -Djava.security.policy=security.policy -server -cp $classpath $mainClass
 * java-1.5.0-sun-1.5.0.16
 * batik-1.7
 * simple-2.8.1
 * batikd-0.1
 * 1) !/bin/bash

The Batik client was a Python script:

import sys from httplib import HTTPConnection host = "localhost" port = 8282 size = sys.argv[1] svg = sys.argv[2] png = sys.argv[3] req = HTTPConnection( host, port ) infile = open( svg, "r" ) req.request( "PUT", "/png?white_trans=1&width=" + size + "&height=5000", infile.read ) resp = req.getresponse outfile = open ( png, "w" ) outfile.write(resp.read) infile.close outfile.close
 * 1) !/usr/bin/env python

Calls were made from batik.sh:

for TESTFILE in `ls $SVGDIR` do    echo -n $TESTFILE " ">>$SCRDIR/error OUTFILE=$(basename $TESTFILE .svg).png TESTFILE=$SVGDIR/$TESTFILE $SCRDIR/batikclient.py $WIDTH $TESTFILE $BASEDIR/batik/$OUTFILE 1>/dev/null 2>>$SCRDIR/error done echo >>$SCRDIR/error
 * 1) !/bin/bash

ImageMagick
Version 7:6.3.7.9.dfsg1

imb.sh:

for TESTFILE in `ls $SVGDIR` do    echo -n $TESTFILE " ">>$SCRDIR/error OUTFILE=$(basename $TESTFILE .svg).png TESTFILE=$SVGDIR/$TESTFILE convert -background white -geometry $WIDTH $TESTFILE PNG:imb/$OUTFILE >/dev/null 2>>$SCRDIR/error done echo >>$SCRDIR/error
 * 1) !/bin/bash

Inkscape
Version 0.46

inkscape.sh:

for TESTFILE in `ls $SVGDIR` do    echo -n $TESTFILE " ">>$SCRDIR/error OUTFILE=$(basename $TESTFILE .svg).png TESTFILE=$SVGDIR/$TESTFILE inkscape -z -w $WIDTH -f $TESTFILE -e $BASEDIR/inkscape/$OUTFILE >/dev/null 2>>$SCRDIR/error done echo >>$SCRDIR/error
 * 1) !/bin/bash

rsvg
Version 2.22.2

for TESTFILE in `ls $SVGDIR` do    echo -n $TESTFILE " ">>$SCRDIR/error OUTFILE=$(basename $TESTFILE .svg).png TESTFILE=$SVGDIR/$TESTFILE rsvg -w$WIDTH $TESTFILE $BASEDIR/rsvg/$OUTFILE >/dev/null 2>>$SCRDIR/error done echo >>$SCRDIR/error
 * 1) !/bin/bash

Test files
The files used were more or less the same. Two of them are no longer on commons, so they were left out; instead Cent.svg was added, giving a total of 56 files.

To give all renderers an even chance, those files were edited that produced errors in any of the programms. The changes were:
 * give all files a height and width attribute on the outer  element, either dimensionless or using px. Conversion from mm, in or pt units is system-dependent, and the Batik server was not able to read those values.
 * File:2006_Brazilian_Election_2nd_round.svg
 * File:2006_Brazilian_Election_Senators.svg
 * File:Arms_Arbuthnot_of_Edinburgh_(entire).svg
 * File:Arms_Viscount_of_Arbuthnott_(entire).svg
 * File:CD-R.svg
 * File:Cross_montessa.svg
 * File:Pfeil_links_oben.svg
 * File:Symbol_LED.svg


 * delete an errant clip-rule attribute from the outer . It makes no sense there, and rsvg returns it as an error.
 * File:Aztreonam_structure.svg


 * rename files with non-ASCII-characters. Python had problems with this.
 * File:Sierpiński_curve_order_5.svg


 * all others were unchanged.
 * File:12communesWilayaConstantine.svg
 * File:18_ABC_DUI.svg
 * File:1-D_kinematics.svg
 * File:200pF_capacitance.svg
 * File:Accidentals-piano_keyboard.svg
 * File:Adjustable_wrench.svg
 * File:A_large_blank_world_map_with_oceans_marked_in_blue.svg
 * File:Alaska_compared_to_Lower_48.svg
 * File:AMD_A64_Opteron_arch.svg
 * File:Ankerreactie.svg
 * File:At-will_employment_-_covenant-of-good-faith-and-fair-dealing_exceptions.svg
 * File:Ballvalve.svg
 * File:BBC_broadcasting_expenditure_2005-2006.svg
 * File:BlankMap-USA-states-Canada-provinces.svg
 * File:Blason_ville_fr_Ablis_(Yvelines).svg
 * File:Brain_Surface_Gyri.SVG
 * File:Cent.svg
 * File:Cherenkov2.svg
 * File:Cometorbit.svg
 * File:Cscr-former.svg
 * File:Ensign_of_the_Royal_Australian_Air_Force.svg
 * File:EspecesMammiferesMenacees_fr.svg
 * File:Flag_of_Cyprus_(bordered).svg
 * File:Flag_of_Ten_Boer.svg
 * File:Glasbutton_Tipp.svg
 * File:HH_object_diagram.svg
 * File:Ironless_electric_motor.svg
 * File:Japanese_Road_sign_(Children).svg
 * File:Japanese_Road_sign_(Falling_rocks).svg
 * File:Map_of_USA,_NFL.svg
 * File:Map_of_US_sodomy_laws.svg
 * File:MARTA_Rail_Map.svg
 * File:NucleicAcid.svg
 * File:Nuvola_apps_kalzium.svg
 * File:Nuvola_apps_package_graphics.svg
 * File:Pictgram_bicycle_man.svg
 * File:Primitive.svg
 * File:Q_space.svg
 * File:Replace_this_image_PL.svg
 * File:Squaring_the_square.svg
 * File:Status_9.svg
 * File:SVG_filter_feTurbulence.svg
 * File:USA_Counties.svg
 * File:Violet_box.svg
 * File:Wikipedia's_W.svg
 * File:X_Cubed.svg

Full test results
I have run only 11 tests so far, but since results are relatively consistent, I do not see the need for more at this point. It is worth to mention that the numbers for Batik are only correct if you do a few "test-runs" after starting the server, since unerringly one of the first server requests will lead to a hang-up where Java complains about a locking assertion failure. This only happens once for every server start, is independent of the files serviced and takes about 50 seconds. Then all requests are handeled without further errors. The backtrace is:

Locking assertion failure. Backtrace:
 * 1) 0 /usr/lib/libxcb-xlib.so.0 [0xb1302767]
 * 2) 1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_unlock+0x31) [0xb13028b1]
 * 3) 2 /usr/lib/libX11.so.6(_XReply+0xfd) [0xa733c1bd]
 * 4) 3 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so [0xa740edce]
 * 5) 4 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so [0xa73f8d77]
 * 6) 5 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so [0xa73f8ef3]
 * 7) 6 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so(Java_sun_awt_X11GraphicsEnvironment_initDisplay+0x26) [0xa73f9136]
 * 8) 7 [0xb13d7fe7]
 * 9) 8 [0xb13d1b6b]
 * 10) 9 [0xb13d1b6b]
 * 11) 10 [0xb13cf236]
 * 12) 11 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb765feec]
 * 13) 12 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb782fae8]
 * 14) 13 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb765fd1f]
 * 15) 14 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so(JVM_DoPrivileged+0x32d) [0xb76bd82d]
 * 16) 15 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/libjava.so(Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2+0x3d) [0xb736e30d]
 * 17) 16 [0xb13d7898]
 * 18) 17 [0xb13d1a94]
 * 19) 18 [0xb13cf236]
 * 20) 19 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb765feec]

No file-related errors were reported after the above mentioned changes were made to the files. The three numbers are: Wallclock time, User CPU, Kernel CPU.

ImageMagick 81.86	77.78	3.62 Inkscape   71.21	63.60	6.69 Batik      57.84	2.22	1.14 rsvg       41.45	39.43	1.94 ImageMagick 82.13	78.03	3.41 Inkscape   70.93	63.89	6.54 Batik      57.14	2.20	1.17 rsvg       41.49	39.30	2.10 ImageMagick 81.72	77.84	3.48 Inkscape   71.04	64.09	6.38 Batik      58.89	2.24	1.08 rsvg       41.51	39.33	2.06 ImageMagick 82.05	78.00	3.37 Inkscape   70.87	63.56	6.77 Batik      57.26	2.16	1.14 rsvg       41.48	39.32	2.05 ImageMagick 81.76	78.03	3.34 Inkscape   70.96	63.71	6.69 Batik      57.57	2.30	1.05 rsvg       41.48	39.26	2.14 ImageMagick 81.83	78.06	3.36 Inkscape   71.02	63.70	6.70 Batik      58.30	2.24	1.11 rsvg       41.45	39.28	2.05 ImageMagick 82.13	78.02	3.36 Inkscape   70.86	63.73	6.64 Batik      57.07	2.24	1.10 rsvg       41.46	39.34	2.04 ImageMagick 82.12	77.88	3.54 Inkscape   70.95	63.73	6.71 Batik      57.15	2.24	1.11 rsvg       41.48	39.47	1.98 ImageMagick 81.79	77.90	3.47 Inkscape   70.98	63.80	6.65 Batik      58.58	2.34	0.97 rsvg       41.52	39.33	2.10 ImageMagick 81.81	77.98	3.41 Inkscape   70.82	63.79	6.48 Batik      57.76	2.26	1.04 rsvg       41.52	39.31	2.12 ImageMagick 82.05	77.83	3.54 Inkscape   70.95	63.91	6.55 Batik      57.77	2.28	1.03 rsvg       41.48	39.25	2.15