SVG benchmarks/test 20090816

From mediawiki.org

Scripts[edit]

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 times

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[edit]

svgbench.sh:

#!/bin/bash

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

Batik harness[edit]

The Batik server was run with

  • java-1.5.0-sun-1.5.0.16
  • batik-1.7
  • simple-2.8.1
  • batikd-0.1

resulting in the command

#!/bin/bash

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

The Batik client was a Python script:

#!/usr/bin/env python
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()

Calls were made from batik.sh:

#!/bin/bash
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

ImageMagick[edit]

Version 7:6.3.7.9.dfsg1

imb.sh:

#!/bin/bash
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

Inkscape[edit]

Version 0.46

inkscape.sh:

#!/bin/bash
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

rsvg[edit]

Version 2.22.2

#!/bin/bash
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

Test files[edit]

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:

  • delete an errant clip-rule attribute from the outer <svg>. It makes no sense there, and rsvg returns it as an error.

Full test results[edit]

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:
#0 /usr/lib/libxcb-xlib.so.0 [0xb1302767]
#1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_unlock+0x31) [0xb13028b1]
#2 /usr/lib/libX11.so.6(_XReply+0xfd) [0xa733c1bd]
#3 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so [0xa740edce]
#4 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so [0xa73f8d77]
#5 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/xawt/libmawt.so [0xa73f8ef3]
#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]
#7 [0xb13d7fe7]
#8 [0xb13d1b6b]
#9 [0xb13d1b6b]
#10 [0xb13cf236]
#11 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb765feec]
#12 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb782fae8]
#13 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so [0xb765fd1f]
#14 /usr/lib/jvm/java-1.5.0-sun-1.5.0.16/jre/lib/i386/server/libjvm.so(JVM_DoPrivileged+0x32d) [0xb76bd82d]
#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]
#16 [0xb13d7898]
#17 [0xb13d1a94]
#18 [0xb13cf236]
#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