scryer-prolog
scryer-prolog copied to clipboard
assertz/1 performance could still be improved
Sample query:
?- time((between(1,100_000,N),assertz(p(N)),false)). % CPU time: 1.486s, 1_000_040 inferences false.
For comparison, with GNU Prolog:
| ?- between(1,100000,N),assertz(p(N)),false. (48 ms) no
So, a significant speed improvement still seems possible and would be nice to have. (Low priority.)
To be clear: I think it is great that also dynamically asserted clauses are compiled to WAM code! It may cost a bit of compilation time, but on the plus side, it lets us truly test the actual WAM compiler and interpreter dynamically, and it also speeds up subsequent execution of these dynamically asserted clauses!
Maybe the very frequent case of dynamically asserted facts can be automatically recognized and compiled more efficiently.