Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "w3c-validation/rdf-tests"]
path = w3c-validation/rdf-tests
url = https://github.com/w3c/rdf-tests
[submodule "benches/trainmarks"]
path = benches/trainmarks
url = https://github.com/DeciSym/trainmarks.git
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ repository = "https://github.com/DeciSym/de"
default-run = "de"
keywords = ["hdt", "rdf", "semantic-web", "triple-store", "sparql"]
categories = ["command-line-utilities"]
# The trainmarks benchmark submodule is a separate repo of fixtures and
# harnesses for other engines; it has no place in the published crate.
exclude = ["benches/trainmarks"]

[[bin]]
name = "de"
path = "src/main.rs"
bench = false

[[bench]]
name = "benchmark"
name = "trainmarks"
harness = false

[dependencies]
Expand Down
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
HUB ?= decisym
TAG ?= latest
VERSION ?= 0.0.0-test
# Dataset scale for the trainmarks benchmarks: medium (~100K triples),
# large (~1M) or xlarge (~10M). Must match DE_BENCH_SCALE at bench time.
BENCH_SCALE ?= large

init:
scripts/download-sample-bench.sh
Expand All @@ -21,8 +24,15 @@ test: init

presubmit: lint test

bench: init
cargo bench
# Check out the trainmarks submodule and generate the N-Triples and Turtle
# fixtures the trainmarks bench target reads. Split out from `init` because
# they are ~150 MB at the default scale and only the benchmarks need them.
bench-init: init
git submodule update --init benches/trainmarks
python3 scripts/gen-trainmarks-data.py $(BENCH_SCALE)

bench: bench-init
DE_BENCH_SCALE=$(BENCH_SCALE) cargo bench

build:
cargo build --features=server
Expand Down
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,49 @@ Run W3C RDF/SPARQL integration tests:
```sh
cargo test --all-features --test w3c-sparql
```

## Benchmarks

The `trainmarks` criterion suite covers `create` and `query` over the synthetic
e-commerce graph from [trainmarks](https://github.com/DeciSym/trainmarks),
checked out as a submodule at `benches/trainmarks`. It exists to catch
performance regressions at a realistic dataset size, not to compare `de`
against other engines.

It measures four things: building an HDT from N-Triples, building one from
Turtle (the only path that runs the RDF parser), the five queries against a
prebuilt HDT, and one query given a Turtle file directly, which `de` converts
to a temporary package before evaluating.

`make bench` first checks out the submodule and generates the fixtures the
suite reads:

```sh
make bench
```

The dataset scale is `BENCH_SCALE` — `medium` (~100K triples), `large` (~1M,
the default) or `xlarge` (~10M):

```sh
BENCH_SCALE=medium make bench
```

`make bench` passes the scale through to the suite as `DE_BENCH_SCALE`, which
is also what to set when driving `cargo bench` directly. The fixtures and the
benchmark must agree on it, since the scale is part of every benchmark id
(`trainmarks_query/large/q3_join_3_entities`) and criterion compares each run
against the stored baseline for that id:

```sh
make bench-init # once, to lay down the fixtures
DE_BENCH_SCALE=large cargo bench --bench trainmarks
DE_BENCH_SCALE=large cargo bench --bench trainmarks -- q3_join_3_entities
```

Without the fixtures the suite prints how to get them and measures nothing, so
`cargo bench` still works on a fresh clone.

The queries are trainmarks' own `q1`–`q5`, shared verbatim with the other
engines in that report. `q6_delete_insert` is omitted: it is a SPARQL Update,
and HDT packages are immutable.
133 changes: 0 additions & 133 deletions benches/benchmark.rs

This file was deleted.

1 change: 1 addition & 0 deletions benches/trainmarks
Submodule trainmarks added at 3430aa
Loading
Loading