scryer-prolog icon indicating copy to clipboard operation
scryer-prolog copied to clipboard

assertz/1 performance could still be improved

Open triska opened this issue 2 years ago • 1 comments

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.)

triska avatar Dec 20 '23 22:12 triska

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.

triska avatar Dec 21 '23 18:12 triska