You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The core reasoner (currently called TripleStore) is only capable of doing a round of reasoning over all tuples at once. This is optimal for the first round of reasoning, but causes a lot of re-computation during subsequent rounds.
If proof generation speed is found to be an issue, this optimization should be implemented:
Instead of, or in addition to fn apply. Add a function called e.g. insert_apply:
insert_apply can skip much of the wasted computation by assuming that the tuples stored in self have already been processed that the provided triple is the only potentially novel fact.
Alternate, and possibly more efficient, versions of insert_apply:
For that last one, insert_apply may assume that other is already processed or may process other itself. That last one is effectively a binary operation that merges two triple stores together, making deductions in the process. It could be used to recursively build a larger TripleStore out of smaller ones.
The text was updated successfully, but these errors were encountered:
This implements differential rule applications as suggested in #1
As a side effect of implementing that optimization I also reduced the cased where LowRule needed to be cloned within the hot path. The reduction in clones made a small difference but differential rule applications had the greated effect.
Before:
```
running 4 tests
test ancestry::infer_ ... bench: 2,339,370 ns/iter (+/- 36,027)
test ancestry::prove_ ... bench: 2,332,249 ns/iter (+/- 61,357)
test recursion_minimal::infer_ ... bench: 35,339 ns/iter (+/- 1,012)
test recursion_minimal::prove_ ... bench: 34,850 ns/iter (+/- 312)
```
After:
```
test ancestry::infer_ ... bench: 1,683,208 ns/iter (+/- 49,885)
test ancestry::prove_ ... bench: 1,792,665 ns/iter (+/- 22,206)
test recursion_minimal::infer_ ... bench: 17,601 ns/iter (+/- 457)
test recursion_minimal::prove_ ... bench: 23,608 ns/iter (+/- 677)
```
We see a ~24% improvment for the 20 node ancestry test case. The percentage improvement becomes larger as node count increases. The previous version was too slow to even include a benchmark with larger node count (I lost patience waiting.). The new version is fast enough to scale to larger node counts so I've added another couple larger benchmarks in this commit: `ancestry::infer_30` and `test ancestry::prove_30`
The core reasoner (currently called
TripleStore
) is only capable of doing a round of reasoning over all tuples at once. This is optimal for the first round of reasoning, but causes a lot of re-computation during subsequent rounds.If proof generation speed is found to be an issue, this optimization should be implemented:
Instead of, or in addition to fn apply. Add a function called e.g.
insert_apply
:insert_apply
can skip much of the wasted computation by assuming that the tuples stored in self have already been processed that the providedtriple
is the only potentially novel fact.Alternate, and possibly more efficient, versions of
insert_apply
:For that last one, insert_apply may assume that
other
is already processed or may processother
itself. That last one is effectively a binary operation that merges two triple stores together, making deductions in the process. It could be used to recursively build a larger TripleStore out of smaller ones.The text was updated successfully, but these errors were encountered: