Benchmarks
bench/ holds a Go harness (stdlib only) that checks Liuska against the performance targets and, if wkhtmltopdf is installed, compares the two.
.\bench\run.ps1 # Windows: builds liuska from generator/, runs everything
.\bench\run.ps1 -- -sets 1page,1k -duration 5s # quicker
bench/run.sh # Linux/macOS/Git Bash
LIUSKA=/usr/local/bin/liuska bench/run.sh -runs 20
What it does:
- Generates data sets in
bench/out/:1page(20 rows),1k(1,000 rows, about 25 pages) and10k(10,000 rows). It writes each as JSON for Liuska and as equivalent HTML for wkhtmltopdf (data-*.html, plusheader.html/footer.htmlwith the usual page-number script). - Cold: runs
liuska render -t template.json -d data-<set>.json -o …N times and times each run from process start to exit (p50/p95). - Warm: starts
liuska serveon a free port and sendsPOST /api/renderfrom-cconcurrent clients for-duration, then reports renders/s and latency. - wkhtmltopdf: if it is on
PATH(or passed with-wkhtmltopdf), the harness renders the same HTML cold, N times, and adds a speedup column. Otherwise this step is skipped. - Prints a Markdown table and writes
out/results.mdandout/results.json. Paste the table into the README.
Flags: -sets, -runs, -duration, -c, -gen-only, -skip-cold, -skip-serve, -liuska, -wkhtmltopdf, -out.
To compare against wkhtmltopdf on another machine without running Liuska there, run go run . -gen-only and render the HTML yourself:
wkhtmltopdf --enable-local-file-access -s A4 --header-html out/header.html --footer-html out/footer.html out/data-1k.html wk-1k.pdf
The targets are listed in the spec: 1-page render < 5 ms warm, 1k rows < 100 ms, 10k rows < 1 s, cold CLI < 100 ms and serve > 200 renders/s. The engine's microbenchmarks (go test -bench . ./renderer) measure the in-process numbers. This harness measures what a user actually sees.