souffle-lang / souffle

Soufflé is a variant of Datalog for tool designers crafting analyses in Horn clauses. Soufflé synthesizes a native parallel C++ program from a logic specification.
http://souffle-lang.github.io/
Universal Permissive License v1.0
916 stars 207 forks source link

Removal of RamDrop #1195

Closed b-scholz closed 4 years ago

b-scholz commented 4 years ago

We currently have two statements to purge a relation:

In an old implementation of Soufflé the functionality of RamDrop deleted the relation from memory whereas RamClear deleted the entries of a relation.

In the latest revisions, the semantics of RamDrop become similar to RamClear and hence there is no need to keep RamDrop as a statement anymore.

Hence, I suggest to remove the RamDrop statement to make the RAM instruction simpler and more concise. There might be a minor memory overhead for the interpreter keeping empty relations rather than deleting the relation. However, this memory benefit should be minimal in practice.

mmcgr commented 4 years ago

If it can be detected that a relation won't be used again, then the final implementation (Synthesiser/Interpreter) could be responsible for deleting the relation if it's ever deemed helpful to do so.

b-scholz commented 4 years ago

We have two situations for a clearing the entries of a relation: (1) the delta relation needs to be cleared before it becomes the next new relation (this is functional and must be done) (2) the relation has no further use in the evaluation (i.e. not used on the RHS of a clause nor in an output statement) to reduce the memory overhead

Again, I don't see the reason to keep drop (with the semantics of deleting a relation) because we have now external C++ interfaces that may assume that relations still exists after the evaluation. That just complicates the code for the interfaces (checks for null pointers etc.).