Skip to content

Benchmark

LaraSVG ships with a benchmark.php script that measures throughput, latency, and peak memory usage for each provider.

Running the Benchmark

bash
# Run all available drivers (up to 10,000 conversions or 60 s each)
php benchmark.php

# Run a single driver
php benchmark.php resvg

# Custom limits
php benchmark.php --max=500 --time=30

# Print results without writing benchmark.md
php benchmark.php --no-write

The script auto-detects which providers are installed and skips any that are missing.

Results

SVG → PNG conversion, 200×200 px output. Each driver is run for up to 10,000 conversions or 60 s, whichever comes first. Peak RSS is the maximum resident set size of the converter binary for one conversion.

Date: 2026-02-15 Platform: Darwin (arm64), PHP 8.4.17

Summary

DriverVersionConversionsThroughputAvg latencyp95 latencyPeak RSS
resvg0.47.06,474107.9 / sec9.3 ms10.4 ms4.7 MB
rsvg-convert2.61.41,76629.4 / sec34.0 ms37.6 ms25.3 MB
cairosvg2.8.24898.1 / sec122.8 ms125.9 ms45.0 MB
inkscape1.4.33035.0 / sec198.3 ms210.2 ms129.7 MB

Throughput Comparison

resvg           ████████████████████████████████████████ 107.9 / sec
rsvg-convert    ███████████ 29.4 / sec
cairosvg        ███ 8.1 / sec
inkscape        ██ 5.0 / sec

Per-Driver Detail

resvg

MetricValue
Conversions completed6,474
Total time60.0 s
Throughput107.90 conversions/sec
Avg latency9.3 ms
Min latency8.4 ms
p50 latency9.1 ms
p95 latency10.4 ms
Max latency40.5 ms
Peak binary RSS4.7 MB

rsvg-convert

MetricValue
Conversions completed1,766
Total time60.0 s
Throughput29.43 conversions/sec
Avg latency34.0 ms
Min latency31.4 ms
p50 latency33.3 ms
p95 latency37.6 ms
Max latency44.3 ms
Peak binary RSS25.3 MB

cairosvg

MetricValue
Conversions completed489
Total time60.1 s
Throughput8.14 conversions/sec
Avg latency122.8 ms
Min latency120.3 ms
p50 latency122.5 ms
p95 latency125.9 ms
Max latency135.5 ms
Peak binary RSS45.0 MB

inkscape

MetricValue
Conversions completed303
Total time60.1 s
Throughput5.04 conversions/sec
Avg latency198.3 ms
Min latency192.6 ms
p50 latency196.5 ms
p95 latency210.2 ms
Max latency216.5 ms
Peak binary RSS129.7 MB

Notes

  • Benchmark measures wall-clock time per conversion including process spawn overhead.
  • Peak RSS is sampled via /usr/bin/time for a single representative conversion and reflects the converter binary's own memory, not PHP.
  • First-run warmup is excluded from all measurements.
  • Results vary by machine load, SVG complexity, and binary version.
  • Inkscape and CairoSVG include interpreter startup cost per invocation. For high-throughput production use, consider daemon modes (Inkscape shell mode, CairoSVG server) to amortize startup costs.

Released under the MIT License.