perf: SPARQL hexastore index crossover analysis (hydrate+N3 vs direct indexed queries) #45
Replies: 3 comments
Post-preload SPARQL crossover (execute only, Deno 2.7.14 Windows)Benchmarks now preload datasets and engines at module load; timed slices measure query execution only. See PR #67 and
Notes: Fair timing requires module preload (or equivalent warm containers). hydrate+N3 wins on selective patterns when the graph is already in memory; libsqlStore is the scale path without mirroring the full graph into N3. Prior multi-second p99 outliers were largely per-iteration dynamic import and GC between bench slices, not raw SPARQL engine cost alone. |
|
Follow-up (May 2026): Large-scale crossover methodology moved to discussion #69. Post-PR #85: standard bench (1k–50k) still compares hydrate+N3 vs libsqlStore; 100k–1M is libsqlStore only, quads-only preload ( |
Post-preload SPARQL crossover through 1M (execute only, Deno 2.8.0 Windows)Extended from the 1k–50k table above with large-scale captures after PR #85. Benchmarks preload datasets and engines at module load; timed slices measure 100k–1M: libsqlStore only (
Module preload ( Notes:
|
Uh oh!
There was an error while loading. Please reload this page.
Original issue: https://github.com/wazootech/worlds-client-ts/issues/8
Hexastore SPARQL crossover benchmark
This issue documents the performance crossover analysis between two SPARQL query strategies on the
hexastorebranch:LibsqlStoreusing hexastore covering indexes, no hydration neededMethodology
:memory:SQLiteSELECT ?p ?o WHERE { <urn:entity:0> ?p ?o }— returns ~10 rows at any scaleSELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 100— touches all rowsResults: Subject-bound query (hexastore sweet spot)
Crossover point: ~5k–10k quads for cold-start average latency. Beyond 10k, hexastore pull-away widens dramatically (3–96x faster).
Results: Full-scan query (LIMIT 100)
For full scans, N3 consistently wins by ~1.1–1.6x — both approaches touch all data, but N3 avoids SQL deserialization overhead.
Key takeaways
Recommendation: Use hexastore for selective SPARQL queries on datasets >10k quads where hydration cost dominates, or when memory is constrained. Use N3.Store for repeatedly queried datasets <10k quads where the one-time hydration is amortized.
Related benchmarks
All reactions