Jump to content

User:Mr.Z-man/SVG

From mediawiki.org

I've been working on an experimental new SVG converter.

The inkscape people added an option last September to run inkscape as in interactive shell. This allows multiple operations to be done without having to start up and shut down the whole program for each one.

I wrote a quick Python program to run inkscape in shell mode as a daemon process, then wrote a short C program to communicate with it via a UNIX socket.

I did a few profiling tests, similar to those David Gerard did in 2008, though less exhaustive or scientific. The tests were run on a system running Fedora 11 as a guest OS on Sun VirtualBox (Windows Vista host OS) with a 2.0 GHz Intel Core 2 Duo mobile processor with 1024 MB memory given to the VM.

The source code and installation instructions are here.

Test 1

[edit]

The first test compared ImageMagick (6.5.1-2), Inkscape (0.46+devel), my Inkscape daemon, and rsvg (2.26.0). I didn't test Batik as I didn't want to bother with installing it.

I used 25 randomly chosen SVGs from commons, the PNGs produced were 600px wide. Only total time was calculated for 15 runs. The min, average, and max time for each:

  ImageMagick Inkscape Inkscape daemon rsvg
Minimum 28.93s 37.57s 14.30s 8.08s
Average 42.21s 54.92s 23.96s 12.94s
Maximum 65.24s 81.26s 45.34s 23.31s

Test 2

[edit]

In this test I did 1 run over the same 25 images using the inkscape daemon and rsvg only, directly comparing their performance on each image. The time given after each file is the time difference. A positive number means rsvg was faster, a negative number means the inkscape daemon was faster:

Notes

[edit]
  • Inkscape leaks memory slowly, and it starts to become an issue after doing several dozen conversions, causing it to become extremely slow. This necessitated a change in the program to restart the inkcape subprocess after every 50 conversions. I chose 50 as an arbitrary number, it could possibly be increased, especially on a system with more memory.