Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.prolog > #14751
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Newsgroups | comp.lang.prolog |
| Subject | Novacore goes native (=)/2 and (==)/2 bisimulation (Was: Scryer Prolog has the most useless max_depth) |
| Date | 2025-08-02 14:45 +0200 |
| Message-ID | <106l19p$3648u$1@solani.org> (permalink) |
| References | <105vr4s$2r116$1@solani.org> <106ktkr$38lbm$1@solani.org> |
Hi,
Since the pairs example doesn't really feature
deep unification, going native gives only a speed-up
of a factor two. The reason is that for small
examples the linear search association map in the
100% Prolog implementation, fares as good as a
hash table based associaton map in a native
implementation. We nevertheless traded (~)/2 and
(~~)/2 for native implementations (=)/2 and (==)/2
which is are ca 2-times faster in the given examples.
Some fine tuning in the future might maybe give better results,
but here are the newest comparisons for your enjoyment.
It seems we clearly beat Scryer Prolog, but stiil have
SWI-Prolog and Trealla Prolog in front of us:
/* SWI-Prolog 1.3.5 */
?- time((between(1,30,_), unify, fail; true)).
% 570,118 inferences, 0.047 CPU in 0.042 seconds (113% CPU, 12162517 Lips)
?- time((between(1,30,_), equals, fail; true)).
% 570,118 inferences, 0.031 CPU in 0.042 seconds (75% CPU, 18243776 Lips)
/* Trealla Prolog 2.79.26 */
?- time((between(1,30,_), unify, fail; true)).
% Time elapsed 0.126s, 1173903 Inferences, 9.347 MLips
?- time((between(1,30,_), equals, fail; true)).
% Time elapsed 0.126s, 1173903 Inferences, 9.319 MLips
/* Dogelog Player 1.3.5 for Java */
?- time((between(1,30,_), unify, fail; true)).
% Zeit 167 ms, GC 0 ms, Lips 6850113, Uhr 01.08.2025 22:41
?- time((between(1,30,_), equals, fail; true)).
% Zeit 165 ms, GC 0 ms, Lips 6933145, Uhr 01.08.2025 22:38
/* Scryer Prolog 0.9.4-547 */
?- time((between(1,30,_), unify, fail; true)).
% CPU time: 0.222s, 1_174_119 inferences
?- time((between(1,30,_), equals, fail; true)).
% CPU time: 0.221s, 1_147_809 inferences
Bye
Mild Shock schrieb:
>
> Take this cute example:
>
> ?- [user].
> dfa(Q0, [Q3,Q4]) :-
> Q0 = f(Q1, Q2),
> Q1 = f(Q3, Q2),
> Q2 = f(Q1, Q4),
> Q4 = f(Q1, Q4),
> Q3 = f(Q3, Q2).
>
> Try this example in Scryer-Prolog:
>
> /* Scryer Prolog 0.9.4-547 */
> ?- dfa(X, Y).
> %%% tons and tons of print out
> (...)))),f(f(f(...,f(...)),f(f(...),...)),f(f(...,...),
> f(f(...),...)))),f(f(f(f(...,f(...)),f(...,...)),
> f(f(...,f(...)),f(f(...),...))),f(f(f(...,f(...)),f(...,...)),
> f(f(...,f(...)),f(f(...),...)))))))))))))))))))].
>
> Was more expecting something like
>
> /* SWI-Prolog 9.3.26 */
> ?- dfa(X, Y).
> X = f(f(_S1, _S3), _S3), % where
> _S1 = f(_S1, _S3),
> _S2 = f(f(_S1, _S3), _S2),
> _S3 = f(f(_S1, _S3), _S2),
> Y = [_S1, _S2].
>
> Mild Shock schrieb:
>> Hi,
>>
>> Having fun with Bisimulation, and a new test
>> suite of nasty circular pairs. But how store
>> circular pairs, if clauses do not support
>>
>> circular terms. Well chop it up into equations,
>> I create 1000 such equation pairs:
>>
>> test([A = c(A, B), C = c(A, D), E = n, _ = c(F, B),
>> F = c(C, C), G = c(G, D), D = c(E, C), B = n],
>> [H = c(H, I), J = c(K, I), L = c(L, I), I = c(M, N),
>> O = c(K, J), N = n, K = c(K, J), M = c(K, O)]).
>> Etc..
>>
>> The pairs are nasty because the usual compare_with_stack/2
>> chokes on them. Here some results:
>>
>> /* SWI-Prolog 9.3.26 */
>> ?- time((between(1,30,_), part, fail; true)).
>> % 540,118 inferences, 0.047 CPU in 0.041 seconds (115% CPU, 11522517
>> Lips)
>> true.
>>
>> /* Trealla Prolog 2.78.40 */
>> ?- time((between(1,30,_), part, fail; true)).
>> % Time elapsed 0.113s, 1143903 Inferences, 10.157 MLips
>> true.
>>
>> /* Scryer Prolog 0.9.4-417 */
>> ?- time((between(1,30,_), part, fail; true)).
>> % CPU time: 0.226s, 1_117_809 inferences
>> true.
>>
>> /* Dogelog Player 1.3.5 */
>> ?- time((between(1,30,_), part2, fail; true)).
>> % Zeit 309 ms, GC 0 ms, Lips 8693718, Uhr 25.07.2025 13:47
>> true.
>>
>> The amazing thing is, I compared a 100% Prolog
>> implementation, so there is a lot of head room
>> for improvement:
>>
>> part2 :-
>> bitest(X,Y), X ~~ Y, fail; true.
>>
>> The operator (~~)/2 is part of library(math),
>> and has been implemented with same_term/2 so far.
>>
>> Bye
>>
>
Back to comp.lang.prolog | Previous | Next — Previous in thread | Find similar | Unroll thread
Novacore goes Bisimulation: Scryer Prolog is Slow! Mild Shock <janburse@fastmail.fm> - 2025-07-25 13:51 +0200
Is Mild Shock going rogue? (Was: Novacore goes Bisimulation: Scryer Prolog is Slow!) Mild Shock <janburse@fastmail.fm> - 2025-07-25 14:07 +0200
Is Mostowski Collapse a professional mathematician (Was: Is Mild Shock going rogue?) Mild Shock <janburse@fastmail.fm> - 2025-07-25 14:16 +0200
New Project Name: NovaCore becomes VibeCore (Re: Is Mostowski Collapse a professional mathematician) Mild Shock <janburse@fastmail.fm> - 2025-07-25 14:42 +0200
Nice Printing Error Scryer Prolog (Was: Novacore goes Bisimulation: Scryer Prolog is Slow!) Mild Shock <janburse@fastmail.fm> - 2025-07-26 21:33 +0200
Dynamic unify_with_occurs_check/2 speed-up (Was: Nice Printing Error Scryer Prolog) Mild Shock <janburse@fastmail.fm> - 2025-07-26 21:37 +0200
The End of Deutsch-Schorr-Waite [cycle_detection.rs] (Was: Novacore goes Bisimulation: Scryer Prolog is Slow!) Mild Shock <janburse@fastmail.fm> - 2025-07-28 10:50 +0200
Backtracking Branching Association List (Re: The End of Deutsch-Schorr-Waite [cycle_detection.rs]) Mild Shock <janburse@fastmail.fm> - 2025-07-28 11:02 +0200
Do it like in acyclic_decompose/3 (Re: Backtracking Branching Association List) Mild Shock <janburse@fastmail.fm> - 2025-07-28 11:38 +0200
Cache-Trashing vs Cache-Friendly [Code Example] (Re: Do it like in acyclic_decompose/3) Mild Shock <janburse@fastmail.fm> - 2025-07-28 17:27 +0200
Entering the Age of Rational Trees (2025) (Was: The End of Deutsch-Schorr-Waite [cycle_detection.rs]) Mild Shock <janburse@fastmail.fm> - 2025-08-16 13:02 +0200
The End of Debray Allocator (Was: The End of Deutsch-Schorr-Waite [cycle_detection.rs]) Mild Shock <janburse@fastmail.fm> - 2025-08-24 14:44 +0200
The pairs are nasty, otherwise not always slow! (Re: Novacore goes Bisimulation: Scryer Prolog is Slow!) Mild Shock <janburse@fastmail.fm> - 2025-07-30 14:45 +0200
It was painful for my GC, but fixed now (Re: The pairs are nasty, otherwise not always slow!) Mild Shock <janburse@fastmail.fm> - 2025-07-30 14:51 +0200
Scryer Prolog has the most useless max_depth (Re: Novacore goes Bisimulation: Scryer Prolog is Slow!) Mild Shock <janburse@fastmail.fm> - 2025-08-02 13:43 +0200
Novacore goes native (=)/2 and (==)/2 bisimulation (Was: Scryer Prolog has the most useless max_depth) Mild Shock <janburse@fastmail.fm> - 2025-08-02 14:45 +0200
csiph-web