The -collect fn, run at the end of a query, correctly shortcircuits with the following comment: "one empty rel means final set has to be empty"
However, while processing the query clauses, there was no shortcircuit. Because the implementation of lookup-pattern is agnostic to existing rels, this means that the query engine will continue slicing the indexes for every tuple that could possibly match every clause until all clauses are exhausted.
This is a one-line change to add a shortcircuit in resolve-clause if any existing relation is empty. The check is cheap, and it should provide a substantial performance boost in many common cases.
Motivation: substantial performance boost for a real-world app
The
-collect
fn, run at the end of a query, correctly shortcircuits with the following comment:"one empty rel means final set has to be empty"
However, while processing the query clauses, there was no shortcircuit. Because the implementation of
lookup-pattern
is agnostic to existing rels, this means that the query engine will continue slicing the indexes for every tuple that could possibly match every clause until all clauses are exhausted.This is a one-line change to add a shortcircuit in
resolve-clause
if any existing relation is empty. The check is cheap, and it should provide a substantial performance boost in many common cases.Motivation: substantial performance boost for a real-world app