pyshacl-turbo

Performance
Shared dataset pipeline
35.8× faster with RDFS and 11.8× faster with OWL-RL on this 10,000-node synthetic fixture, using less peak memory. The Turbo trio shares one native dataset through parsing, inference and public SHACL validation.
| Pipeline |
Python trio (s) |
Turbo trio (s) |
Speedup |
Python peak (MiB) |
Turbo peak (MiB) |
| Parse → RDFS → SHACL |
15.889 |
0.444 |
35.8× |
139.7 |
126.7 |
| Parse → OWL-RL → SHACL |
11.104 |
0.940 |
11.8× |
151.2 |
123.4 |
Complete scoped and generalized closures, report graphs and report text matched. Peak memory was 9.3% lower for RDFS and 18.4% lower for OWL-RL.
Measured 3 November 2026 on Apple M3 Max / macOS arm64, CPython 3.13.16, uv 0.13.5. Originals: RDFLib 7.6.0 / OWL-RL 7.6.2 / pySHACL 0.40.2, without optional native adapters. Turbo: published rdflib-turbo 0.2.0a33 / owlrl-turbo 0.2.0a1, with pyshacl-turbo code from #137, tested at 9be3f03. That facade wheel was an unpublished build, not the public 0.8.0 release.
Medians use five alternating fresh-process pairs after an untimed warmup; peak RSS uses seven separate cold processes per arm. Times include data parsing, inference and public validation/report construction; imports and SHAPES preparation are outside timing. Memory includes the whole process and retained results, before correctness encoding. These finite fixture results do not establish universal speedups or full drop-in parity. See all samples, output fingerprints and exact artifact identities and the pipeline harness.
Matched public Graph pipeline
Parse → OWL-RL → SHACL: about 11× in this measured synthetic run.
Both arms use public Graph APIs, expand into the same source Graph and validate
in place. The Turbo trio keeps one RDF dataset in memory throughout; a separate
non-timed ownership regression
checks the actual shared route without adding spies to timed children.
| 1,000-literal case |
Python trio (ms) |
Turbo trio (ms) |
Time ratio |
Python peak (MiB) |
Turbo peak (MiB) |
| Literal reflexivity |
285.2 |
25.5 |
11.2× |
88.0 |
86.1 |
| Literal typing |
362.7 |
31.5 |
11.5× |
100.5 |
98.8 |
Measured 31 October 2026, macOS 27.0.1 (arm64), CPython 3.13.16, native uv 0.13.5:
original registry wheels of rdflib-turbo 0.2.0a23 / owlrl-turbo 0.2.0a1 /
pyshacl-turbo 0.7.1, versus RDFLib 7.6.0 / OWL-RL 7.6.2 / pySHACL 0.40.1.
These are medians of five fresh children per arm after a separate warmup.
The total includes Graph construction/parsing, OWL-RL closure construction/expansion and public
validation/report construction; imports, fixture text and SHAPES preparation are
outside. Complete scoped/generalized facts, literal metadata, report/text,
namespace/effect/flag gates passed for rdflib.NORMALIZE_LITERALS=True.
The separate NORMALIZE_LITERALS=False check differs in a global-setting side
effect and has no performance ratio.
Peak RSS is absolute whole-process memory captured before correctness encoding;
it includes imports, setup and retained results. This single-host result is not
a universal speed or memory claim. See the portable
numeric provenance
and method/locked replay.
From a pyshacl-turbo checkout, use a fresh output directory:
uv run --no-project --python 3.13.16 python -I -B benchmarks/matched_graph_driver.py \
--cohort benchmarks/matched-graph-releases.json --roles baseline --widths 1000 \
--repeats 5 --output benchmark-artifacts/matched-graph-readme
Historical measurements and provenance
Compare RDFLib + OWL-RL + pySHACL with
rdflib-turbo,
owlrl-turbo and
pyshacl-turbo used together.
The Turbo pipeline keeps one native dataset through parsing, in-place
inference and SHACL validation.
End-to-end measurements for 1,000 synthetic nodes:
| Platform |
Inference |
Python trio (ms) |
Turbo trio (ms) |
Python peak (MiB) |
Turbo peak (MiB) |
| Linux x86-64 |
RDFS |
522.5 |
47.6 |
47.15 |
68.66 |
| Linux x86-64 |
OWL-RL |
801.3 |
56.4 |
48.69 |
69.29 |
| macOS ARM64 |
RDFS |
702.8 |
80.7 |
55.38 |
59.94 |
| macOS ARM64 |
OWL-RL |
1,028.5 |
72.5 |
55.91 |
60.42 |
Turbo uses more memory in these runs: 8–46% higher whole-process peak RSS.
Ordinary RDF inference closures and complete SHACL report graphs match.
Generalized RDF statements and report text differ, so these timings are
not a full-output speedup claim or a claim of complete drop-in parity.
Measured in CI on 21 October 2026, using source-built wheels and Python 3.13:
rdflib-turbo 0.2.0a7, owlrl-turbo 0.1.0a3, pyshacl-turbo 0.6.0 versus
rdflib 7.6.0, owlrl 7.6.2, pyshacl 0.40.1.
Times are medians of seven samples after warmup and include data parsing,
shape compilation, inference, validation and full report construction. Shapes
are parsed before timing. Memory is the median peak RSS of three fresh processes,
including the interpreter, imports and retained output. Shared CI hosts and small
synthetic cases do not establish universal speedups or large-dataset capacity.
See the complete Linux measurements,
macOS measurements and
continuously recorded benchmark history
for all samples, source identities, dependency locks and other dataset sizes.
Overview
SHACL validation for Python, powered by Rust. The goal is a complete drop-in
replacement for pySHACL, with additional features and better performance.
Companion turbo projects are
rdflib-turbo, for native RDF datasets,
parsing and SPARQL, and owlrl-turbo, for
native RDFS/OWL-RL inference using that dataset runtime. Both begin with limited
alpha APIs. They currently connect to pyshacl-turbo through explicit RDFLib
conversion on the initial releases. The shared-dataset releases accept an
rdflib-turbo Dataset directly: parse with rdflib-turbo, infer with owlrl-turbo's
inplace=True, then call validate(data, shacl_graph=...) on that same object.
Ordinary validation borrows the native dataset; only the report becomes an RDFLib
graph. The runtime protocol and canonical engine-source fingerprint must match.
See versioned pipeline benchmarks.
The inference memory report includes measured
before/after heap, process memory and runtime for the shared pipeline.
In our benchmarks, Turbo was 27–31× faster for SHACL
rules and 123–126× faster for SPARQL pattern workloads than pySHACL 0.40.1
with RDFLib inputs. These measurements include shape compilation, input
conversion and report construction, and require equivalent RDF validation
reports. Some sparse workloads remain slower. Results depend on the data,
shapes and input backend; the report includes all workloads, raw samples and
measurement conditions.
Shape compilation, Core validation, SPARQL constraints, targets, rules and
inference execute in Rust. Compile shapes once and reuse them across datasets;
pass RDFLib graphs or PyOxigraph Stores directly. There is no runtime dependency
on pySHACL or owlrl. Native execution releases the Python GIL.
Compatibility
The adapted pySHACL 0.40.1 non-JS regression suite passes 403/403 cases (100%).
The W3C SHACL 1.0 suite passes 120/120 with RDF document inputs and 119/120 with
RDFLib Graph inputs. See the compatibility report
for test methodology, suite adaptations and individual results. Passing these
suites does not establish complete drop-in compatibility.
Per-suite counts for Turbo and the pinned plain pySHACL, generated from the
harness and the divergence ledger:
| Suite |
Cases |
pyshacl-turbo |
pySHACL |
Ledger intentional / gap |
| W3C SHACL 1.0 (Graph inputs) |
120 |
1 fail, 119 pass |
1 error, 1 fail, 118 pass |
2 / 0 |
| W3C SHACL 1.2 |
933 |
15 error, 51 fail, 670 not-run, 197 pass |
11 error, 69 fail, 670 not-run, 183 pass |
14 / 6 |
| pySHACL upstream (non-JS) |
403 |
first-party: 2 passed; locally-corrected: 1 passed; vendored: 400 passed |
locally-corrected: 1 passed; vendored: 2 failed, 400 passed |
2 / 0 |
| Direct API/CLI contract |
62 |
5 different, 55 equal, 1 reference_error, 1 reference_timeout (compared with pySHACL) |
— |
5 / 2 |
W3C SHACL 1.2 by test type (not-run cases are counted, with a typed reason):
| Type |
Cases |
pyshacl-turbo |
pySHACL |
| EVAL_NODE_EXPR |
276 |
276 not-run |
276 not-run |
| INFER |
41 |
41 not-run |
41 not-run |
| SRL_EVAL |
76 |
76 not-run |
76 not-run |
| SRL_NEGATIVE_STRATIFICATION |
10 |
10 not-run |
10 not-run |
| SRL_NEGATIVE_SYNTAX |
66 |
66 not-run |
66 not-run |
| SRL_NEGATIVE_WELL_FORMEDNESS |
19 |
19 not-run |
19 not-run |
| SRL_POSITIVE_STRATIFICATION |
11 |
11 not-run |
11 not-run |
| SRL_POSITIVE_SYNTAX |
146 |
146 not-run |
146 not-run |
| SRL_POSITIVE_WELL_FORMEDNESS |
14 |
14 not-run |
14 not-run |
| VALIDATE |
274 |
15 error, 51 fail, 11 not-run, 197 pass |
11 error, 69 fail, 11 not-run, 183 pass |
SHACL 1.2 relations to pySHACL: 14 beyond-pyshacl, 6 different-failure, 913 pyshacl-parity. Not-run reasons: 276 NODE_EXPRESSIONS, 11 RDF12_SYNTAX, 41 RULE_INFERENCE, 342 SPARQL_RL.
Upstream outcomes are split by origin: only vendored cases are upstream
passes; the issue-70 fixture is locally corrected and two cases run
first-party native equivalents. Every difference from pySHACL is listed in
tests/divergences.toml (ADR 0047).