potassco / clingo

🤔 A grounder and solver for logic programs.
https://potassco.org/clingo
MIT License
601 stars 79 forks source link

Feature/ordered set #386

Closed rkaminsk closed 2 years ago

rkaminsk commented 2 years ago

Use hash table implementations from https://github.com/Tessil instead of gringo's own implementation. Currently, one can select between the sparse and hopscotch based hash table implementations. The first having a smaller memory footprint while the latter is faster (and currently the default).

The hopscotch based hash tables are slightly faster than gringo's HashSet but have a larger memory footprint. The sparse hash tables have a comparable but still slightly higher memory footprint as compared to gringo's HashSet and are slower. The memory overhead for the hopscotch based hash tables seems to be negligible. The main advantage is that the external implementation have a cleaner interface and do not require sentinel literals.

The sparse hash table implementations performs much better with a prime growth policy but then uses as much memory as the hopscotch based implementation. Maybe more tuning would be possible.