Repository navigation
bench: add the shared SHACL benchmark (10³–10⁶ quads) - #416
Merged
Merged
Conversation
`deno task bench:shacl` generates a seeded people/organizations graph per size, with shapes covering class targets, sh:class, a sequence path, and an inverse path, and about 1% planted violations. Each case runs in its own process and reports total time, phases, OS peak RSS, and the result count: full-graph validation, write-scoped validation (the Worlds proxy), the phases of a full wiki check, and full and scoped `runCheck`. `--emit DIR` writes only `data.nt` and `shapes.ttl`, so a Worlds-side harness can measure the same graph. The write-scoped case re-targets the shapes at the touched nodes with sh:targetNode. Without that, typed neighbours are validated without their own neighbourhood: 542 results over 200 writes, of which 5 were real. Refs #414 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The shared benchmark from #414 (item 1 of its proposed path).
deno task bench:shaclgenerates a seeded graph per size, runs each case in its own process, and prints a Markdown table (--jsonfor raw results). Details are inbench/shacl/README.md.bench/shacl/fixture.ts: a deterministic people/organizations graph as N-Triples. The shapes cover the constraint kinds Performance: SHACL validation at scale (10^6+ quads) across Wiki and Worlds — shared benchmark, shapes memoization, delta-scoped validation #414 flags (class targets,sh:class, a two-step sequence path, an inverse path), and about 1% of people carry a planted violation.bench/shacl/case.ts: one case per process. It reports the total, named phases, OS peak RSS (VmHWMon Linux,PeakWorkingSet64on Windows), and the SHACL result count.bench/shacl/run.ts: the orchestrator.--sizes,--cases,--timeout,--json,--out, and--emit DIR, which writes onlydata.ntandshapes.ttlfor a Worlds-side harness.tests/bench_fixture_test.ts: checks the fixture is deterministic, lands near its target size, and that the shapes find exactly the planted violations.deno.json: thebench:shacltask, plusbench/incheck,fmt, andlint. The benchmark isn't inpublish.includeorpackage.jsonfiles.Finding for wazootech/worlds-sdk-ts#151
Validating a small Δ-plus-neighbourhood graph isn't enough on its own. The neighbourhood contains typed nodes that aren't part of the write, such as the person someone
knows. The shapes' class targets validate them without their neighbourhood, so they report violations that aren't real: 542 results over 200 writes, of which 5 were real. The delta case therefore re-targets the shapes withsh:targetNodeon exactly the touched nodes. #151's scoped validation needs the same thing.Baseline results
Windows 11, x86_64, Deno from
deno task bench:shacl, 15.5 GB RAM with only about 2–3.5 GB free during the run. This was two invocations: every case at 10³–10⁵, and at 10⁶ every case except the two that run OWL-RL inference (wiki-phases,wiki-check-full). Timeout was 1,200 s per case. Peak RSS is the OS'sPeakWorkingSet64for the case's process, including about 170 MB of Deno and module baseline.Validator alone (the part Wiki and Worlds share)
validator-fullWrite-scoped validation (the Worlds proxy, 200 writes)
The fetch is an in-memory
n3index lookup, not D1.Wiki
wiki-check-fullwiki-phases: loadGraph / loadShapes / validateAt 10⁵ the first run had the runner report both inference cases as "exit 1, no stderr". That was the Windows timeout kill being mislabelled, fixed in
1745d85. Thewiki-phasesprocess took 2,892 s to stop, well past its 1,200 s limit. That fits a machine short on memory, but I didn't confirm the cause.What the numbers say
rdf-validate-shaclscales about linearly once the fixed startup cost is small (×3, ×7, ×11 per 10× data) and validates a million quads in 31 s.loadGraphis the wall for the Wiki. It grows ×23 from 10³ to 10⁴ (1.9 s → 43.4 s) and doesn't finish within 20 minutes at 10⁵. A fullwiki checkis capped well below 10⁵ quads by inference, not SHACL. Performance: incremental / single-file wiki render, cache OWL inference #22 and Performance: cross-process graph reuse for wiki render #30 cover inference caching; this is the measurement behind them. Options worth costing are validating against the uninferred graph, as scoped mode already does, or making inference incremental.sh:targetNode). Without that, typed neighbours report violations that aren't there (542 results over 200 writes when 5 were real).sh:triples) would make a scoped check independent of corpus size.Not done
--emitprovides the fixture for it.wiki build, since its check is measured here and the rest isn't SHACL.Checks
deno task check,deno task lint,deno task fmt:check, and the new fixture tests pass locally, and CI runs the full suite. The timeout fix was verified with--timeout 1, which now reportstimeout after 1 s. This PR adds files only underbench/andtests/, plus thedeno.jsontask and include entries. It adds no machine-specific numbers to the repository; those are in this PR and #414.Refs #414
🤖 Generated with Claude Code