Performance
On AMD Ryzen Threadripper PRO 5995WX with 256 GiB RAM, relic records the lowest median wall time on 30 of 31 comparable workloads with 64 threads, and 24 of 31 with one thread, against completed rival runs. The suite compares compiled Souffle (with and without Magic Sets), interpreted Souffle, Nemo, SWI-Prolog, clingo, DuckDB and SQLite.
Speedup = fastest completed rival median ÷ relic median. Above 1× favors relic; below 1× favors the rival. The ratio axis is logarithmic. Hover a point for its medians, or open the timing tables below.
Loading recorded benchmark data…
1 thread
64 threads
Median timings
| Workload | relic | Fastest completed rival | Rival median | Speedup | Unavailable measurements |
|---|
| Workload | relic | Fastest completed rival | Rival median | Speedup | Unavailable measurements |
|---|
Benchmark setup
Native command-line results: AMD Ryzen Threadripper PRO 5995WX, 64 physical cores, 128 hardware threads, 256 GiB RAM, FreeBSD 16.0-CURRENT. Scale 1, ten repetitions per timing. Medians include startup, loading, evaluation and complete answer serialization to discarded stdout for every engine; compilation is excluded. Serial runs include all engines; 64-thread runs compare relic, three Souffle modes and DuckDB. Unavailable measurements remain statuses. These are native CLI measurements.
Complete results, versions and measurement limits · Raw measurements
Relic optimization techniques
Relic evaluates recursive rules in rounds until no new facts are produced. Query rewriting can restrict that work, while the planner chooses how to find matching facts. The techniques below reduce repeated joins, retained data and coordination between workers. The charts measure complete commands rather than the contribution of any single optimization.
- Semi-naive evaluation. After the initial round, recursive evaluation uses the facts added in the previous round as a delta. A recursive join must include at least one delta input, so combinations made entirely from old facts are not repeated. Relic represents a delta as a range in its append-only tuple store, reusing the relation's indexes instead of copying new facts into a separate table. Method reference: Abiteboul, Hull and Vianu, Foundations of Databases, chapter 13. Implementation.
- Magic Sets. A query such as
path(a, Destination)?supplies a starting point. Relic rewrites those bindings into demand predicates, which can avoid computing facts unrelated to the answer. The rewrite shares binding order with the planner; if its work limit is reached, relic can fall back to evaluating the full program. Beeri and Ramakrishnan, On the Power of Magic (1987). Implementation. - Bound recursive query factoring. For eligible recursive predicates, the rewrite separates traversal state from final output. It propagates reachable states and joins them to complete base inputs, instead of carrying intermediate output combinations through recursion. Origin columns keep each answer tied to the bindings that requested it. Eligibility checks determine when this separation preserves the query's meaning. Naughton, Ramakrishnan, Sagiv and Ullman, Efficient Evaluation of Right-, Left-, and Multi-Linear Rules (1989). Implementation.
- Indexed joins and existence checks. The greedy planner uses bindings, relation sizes and key counts to choose join order and access paths. Bound columns let it probe an index for matching rows instead of scanning a whole relation. Filters run once their inputs are available. When a literal only needs to establish existence, a successful match can end that lookup without enumerating all matching rows. Local planning design.
- Interned values and append-only relations. Relic interns values and stores compact identifiers in tuples. Joins compare those identifiers instead of repeatedly comparing string bytes. Within an evaluation, appending tuples gives deltas stable ranges; hash indexes provide membership tests and lookups. Repeated derivations therefore do not create duplicate stored facts. Values and storage.
- Parallel rounds with ordered publication. A shared round reads frozen relation and index views. Workers gather candidates while the input stores remain unchanged, then an ordered merge publishes the results. This separates parallel reads from store mutation and preserves serial identifiers, answers and diagnostics. Rounds that do not justify the coordination cost can stay on the calling thread. Local parallel design.
- Grouped count destinations. A supported full count query feeds producer rows into a key/count destination. It can deliver completed counts without retaining the projection, group guard and answer as separate derived relations. The producer must satisfy the required distinctness proof; query shapes outside the supported grammar use ordinary evaluation. Local aggregation design.
- Thompson regular-expression simulation. The matcher advances explicit lists of instruction states over the input, merging equivalent states instead of revisiting them through separate backtracking paths. For a fixed pattern, matching work grows linearly with input length. Pattern size and compilation still contribute to the cost. Thompson, Regular Expression Search Algorithm (1968). Expression implementation.