Sujet : native implementation of variant/2 can be fast (Was: When do two Prolog terms marry?)
De : janburse (at) *nospam* fastmail.fm (Mild Shock)
Groupes : comp.lang.prologDate : 15. Oct 2024, 00:35:14
Autres entêtes
Message-ID : <vek9rh$e0ud$1@solani.org>
References : 1 2 3 4 5 6
User-Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.19
Ok, I tried a native implementation of variant/2.
I did it in Dogelog Player for Java. Thats a
Prolog system that doesn't have unification for
cyclic terms. So the situation is a little simpler.
Comparing on the same machine and with the data
we have already gathered it is shockingly fast!
/* Dogelog Player 1.2.4, JDK 22 */
?- time(test).
% Zeit 211 ms, GC 0 ms, Lips 7567459, Uhr 15.10.2024 01:30
true.
?- time(test2).
% Zeit 413 ms, GC 0 ms, Lips 10703217, Uhr 15.10.2024 01:30
true.
Here some results:
- SWI-Prolog 9.3.11:
?- time(test).
% 2,126,498 inferences, 0.734 CPU in 0.752 seconds
(98% CPU, 2895657 Lips)
true.
?- time(test2).
% 2,159,795 inferences, 0.234 CPU in 0.236 seconds
(99% CPU, 9215125 Lips)
true.
- Trealla Prolog 2.57.16:
?- time(test).
% Time elapsed 3.128s, 14827949 Inferences, 4.741 MLips
true.
?- time(test2).
% Time elapsed 1.079s, 7775516 Inferences, 7.206 MLips
true.
- Scryer Prolog :
?- time(test3).
% CPU time: 5.653s, 5_192_831 inferences
true.
?- time(test2).
% CPU time: 1.544s, 6_116_163 inferences
true.
Note: test3 is like test, only it uses builtins:variant/2.