Benchmark¶
Synalog is a fork of Logica with the parser and compiler rewritten in Rust. This page tracks how the Rust core compares with the original Python implementation: every program of the compiler test suite is parsed and compiled with both, per engine.
Both implementations run in-process — Synalog through the same PyO3 extension that pip install synalog ships, Logica through its Python modules — so the comparison measures exactly what a Python caller gets, with no process-startup overhead on either side.
How the numbers are computed. Each program's time is the fastest of several runs after a discarded warm-up — the minimum is the cleanest estimator for CPU-bound work, since it is the run least disturbed by GC, the scheduler and cold caches. The headline speedup is the geometric mean of the per-program speedups, which weights every program equally; this is the standard way to average ratios and avoids the trap of a total-time ratio, where a few large programs would dominate the figure. The median is shown alongside it, and the summed wall-clock times are kept only as context.
Results¶
Last run: 2026-06-13 15:34:36 — 504 programs from the compiler test suite. Each measurement is the fastest of 3 runs after a warm-up; the headline speedup is the geometric mean of per-program speedups (every program weighted equally).
| Python | Rust | Speedup (geomean) | (median) | |
|---|---|---|---|---|
| Parse | 13416 ms | 152 ms | 87.1x | 86.7x |
| Compile | 61307 ms | 5163 ms | 13.3x | 13.7x |
| Verify | — | 157 ms | Rust-only | — |
The Python and Rust columns are summed wall-clock time across all programs (context, not the headline: a few large programs dominate that ratio). Verification (synalog.check — safety, stratification, recursion and reserved-name checks) is a Synalog-specific pass; Python Logica folds its analysis into compilation and has no standalone equivalent, so it is reported as a Rust-only total.
| Engine | Programs | Parse speedup | Compile speedup | Verify (Rust) |
|---|---|---|---|---|
| sqlite | 84 | 85.1x | 13.1x | 26 ms |
| duckdb | 84 | 88.5x | 19.0x | 27 ms |
| psql | 84 | 86.9x | 15.2x | 26 ms |
| bigquery | 84 | 87.1x | 11.8x | 26 ms |
| trino | 84 | 87.1x | 11.2x | 26 ms |
| presto | 84 | 87.6x | 11.2x | 26 ms |
Parsing is dominated by the grammar work and speeds up uniformly across engines. Compilation includes SQL generation, so the speedup varies with how much dialect-specific rewriting each engine needs.
Synalog also runs a dedicated verification pass (synalog.check — safety, stratification, recursion and reserved-name checks) before compiling. Python Logica folds the same analysis into compilation and exposes no standalone equivalent, so verification is timed on the Rust side only and reported as an absolute total rather than a speedup.
Plots¶





Reproducing¶
The benchmark needs the synalog wheel and the Python logica package installed (pip install synalog logica, or maturin develop --release for the local crate):
python3 benchmark.py # run everything, write docs/benchmark/
python3 plot_benchmark.py # regenerate the plots
Raw timings are stored in docs/benchmark/results.json, and the tables above come from the generated docs/benchmark/summary.md — both are rewritten on every run, so this page always shows the latest results.