Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.prolog > #14729 > unrolled thread
| Started by | Mild Shock <janburse@fastmail.fm> |
|---|---|
| First post | 2025-07-25 13:51 +0200 |
| Last post | 2025-08-02 14:45 +0200 |
| Articles | 16 — 1 participant |
Back to article view | Back to comp.lang.prolog
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
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-07-25 13:51 +0200 |
| Subject | Novacore goes Bisimulation: Scryer Prolog is Slow! |
| Message-ID | <105vr4s$2r116$1@solani.org> |
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
[toc] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-07-25 14:07 +0200 |
| Subject | Is Mild Shock going rogue? (Was: Novacore goes Bisimulation: Scryer Prolog is Slow!) |
| Message-ID | <105vs19$2r1je$1@solani.org> |
| In reply to | #14729 |
Hi, Is Mild Shock going rogue? Not really, I am only amused that a couple of academic frauds like these here: - Bart Demoen - Ulrich Neumerkel - Paulo Moura - Joseph Vidal-Rosset Think they can oppress what they view a non-academic. Its more explicit in what Bart Demoen wrote back then, but more implicit how the above morons act. For example blocking me from all repesitory, making it impossible for me to raise issues, and strangly discussion by dogmatic nonsense, doesn't increase the willingness of the harassed person to share something: What occurs-check optimizations is SWI Prolog using? https://stackoverflow.com/a/65620337/17524790 Also that gists would be found on archive.org is nonsense. Bye 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 >
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-07-25 14:16 +0200 |
| Subject | Is Mostowski Collapse a professional mathematician (Was: Is Mild Shock going rogue?) |
| Message-ID | <105vsir$2r22m$1@solani.org> |
| In reply to | #14730 |
Hi, Is Mild Shock aka Mostowski Collapse a professional mathematician. Well you can figure out by yourself, just take this piece by Peter Aczel: NON-WELL-FOUNDED SETS Peter Aczel - 24 December 1981 https://les-mathematiques.net/vanilla/uploads/editor/fh/v4pi6qyxfbel.pdf Open the PDF, look at page 4: Mostowski's Collapsing Lemma: Every well-founded graph has a unique decoration. While I had the nick name, you can still see it in the comments section here: https://stackoverflow.com/q/65600226/17524790 I heard a lot of funny interpretations of the nickname: - Is it derived from Wave Function Collapse? - Is it derived from Bridge - Etc.. Not a single person I met knew something about good old set theory. So much to anybody thinking he is superior: I PISS AND SHIT ON YOU Bye Mild Shock schrieb: > Hi, > > Is Mild Shock going rogue? Not really, > I am only amused that a couple of academic > frauds like these here: > > - Bart Demoen > > - Ulrich Neumerkel > > - Paulo Moura > > - Joseph Vidal-Rosset > > Think they can oppress what they view a > non-academic. Its more explicit in what > Bart Demoen wrote back then, but more > > implicit how the above morons act. For > example blocking me from all repesitory, > making it impossible for me to raise issues, > > and strangly discussion by dogmatic nonsense, > doesn't increase the willingness of the > harassed person to share something: > > What occurs-check optimizations is SWI Prolog using? > https://stackoverflow.com/a/65620337/17524790 > > Also that gists would be found on > archive.org is nonsense. > > Bye > > 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 >> >
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-07-25 14:42 +0200 |
| Subject | New Project Name: NovaCore becomes VibeCore (Re: Is Mostowski Collapse a professional mathematician) |
| Message-ID | <105vu2p$2r36e$2@solani.org> |
| In reply to | #14731 |
Hi, On the occassion of bisimulation introduction in library(math), I have to also make another announcement. There is a new Project name: - Sadly novacore.ch was taken, and we had to go with novacuor.ch - Switzerland has already to many Novas, Novartis, Nova-that, Nova-this, etc.. - Prolog and the core is not really new. Even bisimulation is not really new. - So lets try something new VibeCore, admitedly inspired by Vibe Coding... - Lets see how we can put live into the name "vibe". Currently I find: "Karpathy described it as "fully giving in to the vibes, embracing exponentials, and forgetting that the code even exists." Ha Ha, compare_with_stack, has an similar vibe, doesn't work for the pairs, one has to go with compare_with_memo. VibeCore hints to a future with more computing power and a different view on explorative problem solving. Bye Mild Shock schrieb: > Hi, > > Is Mild Shock aka Mostowski Collapse a > professional mathematician. Well you can > figure out by yourself, just take this > > piece by Peter Aczel: > > NON-WELL-FOUNDED SETS > Peter Aczel - 24 December 1981 > https://les-mathematiques.net/vanilla/uploads/editor/fh/v4pi6qyxfbel.pdf > > Open the PDF, look at page 4: > > Mostowski's Collapsing Lemma: > Every well-founded graph has a unique decoration. > > While I had the nick name, you can still see > it in the comments section here: > https://stackoverflow.com/q/65600226/17524790 > > I heard a lot of funny interpretations of the nickname: > - Is it derived from Wave Function Collapse? > - Is it derived from Bridge > - Etc.. > > Not a single person I met knew something > about good old set theory. > > So much to anybody thinking he is superior: > > I PISS AND SHIT ON YOU > > Bye > > Mild Shock schrieb: >> Hi, >> >> Is Mild Shock going rogue? Not really, >> I am only amused that a couple of academic >> frauds like these here: >> >> - Bart Demoen >> >> - Ulrich Neumerkel >> >> - Paulo Moura >> >> - Joseph Vidal-Rosset >> >> Think they can oppress what they view a >> non-academic. Its more explicit in what >> Bart Demoen wrote back then, but more >> >> implicit how the above morons act. For >> example blocking me from all repesitory, >> making it impossible for me to raise issues, >> >> and strangly discussion by dogmatic nonsense, >> doesn't increase the willingness of the >> harassed person to share something: >> >> What occurs-check optimizations is SWI Prolog using? >> https://stackoverflow.com/a/65620337/17524790 >> >> Also that gists would be found on >> archive.org is nonsense. >> >> Bye >> >> 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 >>> >> >
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-07-26 21:33 +0200 |
| Subject | Nice Printing Error Scryer Prolog (Was: Novacore goes Bisimulation: Scryer Prolog is Slow!) |
| Message-ID | <1063ail$2t38a$1@solani.org> |
| In reply to | #14729 |
Hi,
Take these definitions:
test1(X) :- X = f(g(X,_B),_A).
test2(X) :- Y = g(f(Y,A),_B), X = f(Y,A).
Then you get:
/* Scryer Prolog 0.9.4-417 */
?- test1(X), numbervars(X,0,_).
X = f(g(X,'$VAR'(0)),'$VAR'(1)).
?- test2(X), numbervars(X,0,_).
X = f(g(f('$VAR'(0),'$VAR'(1)),g(f(g('$VAR'(1),'$VAR'(0)),
f(g(f('$VAR'(0),'$VAR'(1)),g(f(g('$VAR'(1),'$VAR'(0)),
f(g(f('$VAR'(0),'$VAR'(1)),g(f(g('$VAR'(1),'$VAR'(0)),
f(g(f('$VAR'(0),'$VAR'(1)),g(f(g('$VAR'(1),'$VAR'(0)),
f(g(f('$VAR'(...),'$VAR'(...)),g(f(g(...),'$VAR'(...)),
'$VAR'(...))),'$VAR'(0))),'$VAR'(1))),'$VAR'(0))),'$VAR'(1))),
'$VAR'(0))),'$VAR'(1))),'$VAR'(0))),'$VAR'(1))),'$VAR'(0)).
What the heck is the '$VAR'(0) after the f(g(f( ?
Bye
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
>
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-07-26 21:37 +0200 |
| Subject | Dynamic unify_with_occurs_check/2 speed-up (Was: Nice Printing Error Scryer Prolog) |
| Message-ID | <1063aq7$2t3c1$1@solani.org> |
| In reply to | #14739 |
I am just sifting through my old formerly
Jekejeke Prolog code, and find this dynamic
condition for `unify_with_occurs_check/2`
speed-up. Interesting application of so called
**weighted reference counting**. Namely this
program code one-liner in hasVar():
public boolean hasVar(Object m, Display d, Display d2) {
[...]
if ((refs & MASK_VAR_FRSH) == 0 && d != d2)
return false;
[...]
It basically checks the reference count. If the
variable V is not referenced, it can also not appear
in a term t, so checking V ∈ t is not necessarely.
Why do I mention that, because above condition is
"dynamic". Means its more situation specific.
Why the d!=d2 and the MASK_VAR_FRSH, well because
variables appearing in a clause, do not have really
a reference count zero, as long as the clause is used.
Since clauses are usually initially acyclic, and
the clause variables sooner or later act as conductors,
to the head arguments or goal results, so
that d!=d2 happens quite quickly, and there
is not much loss by the additional conditions.
Mild Shock schrieb:
> Hi,
>
> Take these definitions:
>
> test1(X) :- X = f(g(X,_B),_A).
>
> test2(X) :- Y = g(f(Y,A),_B), X = f(Y,A).
>
> Then you get:
>
> /* Scryer Prolog 0.9.4-417 */
> ?- test1(X), numbervars(X,0,_).
> X = f(g(X,'$VAR'(0)),'$VAR'(1)).
>
> ?- test2(X), numbervars(X,0,_).
> X = f(g(f('$VAR'(0),'$VAR'(1)),g(f(g('$VAR'(1),'$VAR'(0)),
> f(g(f('$VAR'(0),'$VAR'(1)),g(f(g('$VAR'(1),'$VAR'(0)),
> f(g(f('$VAR'(0),'$VAR'(1)),g(f(g('$VAR'(1),'$VAR'(0)),
> f(g(f('$VAR'(0),'$VAR'(1)),g(f(g('$VAR'(1),'$VAR'(0)),
> f(g(f('$VAR'(...),'$VAR'(...)),g(f(g(...),'$VAR'(...)),
> '$VAR'(...))),'$VAR'(0))),'$VAR'(1))),'$VAR'(0))),'$VAR'(1))),
> '$VAR'(0))),'$VAR'(1))),'$VAR'(0))),'$VAR'(1))),'$VAR'(0)).
>
> What the heck is the '$VAR'(0) after the f(g(f( ?
>
> Bye
>
> 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
>>
>
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-07-28 10:50 +0200 |
| Subject | The End of Deutsch-Schorr-Waite [cycle_detection.rs] (Was: Novacore goes Bisimulation: Scryer Prolog is Slow!) |
| Message-ID | <1067djv$2tsqp$1@solani.org> |
| In reply to | #14729 |
Hi,
Assume that we live in a world where we
have excess memory. So we can afford stacks!
And then make the crucial observation,
we can use the stack of the Prolog engine,
no need to create an artificial stack in C,
or use the native stack of C.
I guess SWI-Prolog has already groked the
first we can "afford stacks". But did anybody
already grok the "100% Prolog" idea?
Well we are not yet there 100% Prolog
has still an overhead. Here is a little
test acyclic_term/2:
/* SWI-Prolog 9.3.26, C Stacks and/or Agendas */
?- time((between(1,30,_), acyclic2, fail; true)).
% 330,150 inferences, 0.016 CPU in 0.023 seconds
(69% CPU, 21129600 Lips)
true.
/* Trealla Prolog 2.79.6, ?? */
?- time((between(1,30,_), acyclic2, fail; true)).
% Time elapsed 0.063s, 643413 Inferences, 10.166 MLips
true.
/* Dogelog Player 1.3.5, 100% Prolog */
?- time((between(1,30,_), acyclic2, fail; true)).
% Zeit 115 ms, GC 0 ms, Lips 11803904, Uhr 28.07.2025 10:03
true.
/* Scryer Prolog 0.9.4-417, Deutsch-Schorr-Waite */
?- time((between(1,30,_), acyclic2, fail; true)).
% CPU time: 0.130s, 626_829 inferences
true.
Bye
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-07-28 11:02 +0200 |
| Subject | Backtracking Branching Association List (Re: The End of Deutsch-Schorr-Waite [cycle_detection.rs]) |
| Message-ID | <1067ear$2tt6a$3@solani.org> |
| In reply to | #14741 |
Hi,
So the 115 ms by Dogelog Player are faster than the
0.130s by Scryer Prolog. Quite amazing! From
Dogelog Player library(math):
/**
* acyclic_term(T): [TC2 8.3.11]
* The predicate succeeds when the Prolog term T is an acyclic term,
* otherwise the predicate fails.
*/
% acyclic_term(+Term)
acyclic_term(X) :- sys_cyclic_term(X, []), !, fail.
acyclic_term(_).
% sys_cyclic_term(+Term, +List)
sys_cyclic_term(X, S) :- compound(X),
member(Y, S),
same_term(X, Y), !.
sys_cyclic_term(X, S) :- compound(X),
X =.. [_|L],
member(Y, L),
sys_cyclic_term(Y, [X|S]).
Algorithms that implicitly detect sharing cannot
do much? Since we only need to find a first cycle?
Also a challenge to bring the association list to
native and lets say turn it into a hash table,
don't know yet when and how even somebody would
attempt that. Big advantage of anything not using
Deutsch-Schorr-Waite , no write operation into the
given term. Write operation are sometimes
poison for the CPU and the RAM.
Bye
Mild Shock schrieb:
> Hi,
>
> Assume that we live in a world where we
> have excess memory. So we can afford stacks!
> And then make the crucial observation,
>
> we can use the stack of the Prolog engine,
> no need to create an artificial stack in C,
> or use the native stack of C.
>
> I guess SWI-Prolog has already groked the
> first we can "afford stacks". But did anybody
> already grok the "100% Prolog" idea?
>
> Well we are not yet there 100% Prolog
> has still an overhead. Here is a little
> test acyclic_term/2:
>
> /* SWI-Prolog 9.3.26, C Stacks and/or Agendas */
> ?- time((between(1,30,_), acyclic2, fail; true)).
> % 330,150 inferences, 0.016 CPU in 0.023 seconds
> (69% CPU, 21129600 Lips)
> true.
>
> /* Trealla Prolog 2.79.6, ?? */
> ?- time((between(1,30,_), acyclic2, fail; true)).
> % Time elapsed 0.063s, 643413 Inferences, 10.166 MLips
> true.
>
> /* Dogelog Player 1.3.5, 100% Prolog */
> ?- time((between(1,30,_), acyclic2, fail; true)).
> % Zeit 115 ms, GC 0 ms, Lips 11803904, Uhr 28.07.2025 10:03
> true.
>
> /* Scryer Prolog 0.9.4-417, Deutsch-Schorr-Waite */
> ?- time((between(1,30,_), acyclic2, fail; true)).
> % CPU time: 0.130s, 626_829 inferences
> true.
>
> Bye
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-07-28 11:38 +0200 |
| Subject | Do it like in acyclic_decompose/3 (Re: Backtracking Branching Association List) |
| Message-ID | <1067gdn$2tuqo$2@solani.org> |
| In reply to | #14742 |
Hi, Interstingly there is an obvious way how to do it without a braching association list, that has different futures so to speack, the below code repeatedly generates dfferent association lists via [X|S]. We could of course instead do a threading of the association list through some predicate, and use some state on each entry inside the association list, similar like in acyclic_decompose/3 we used a threading and entry state. Bye Mild Shock schrieb: > Hi, > > So the 115 ms by Dogelog Player are faster than the > 0.130s by Scryer Prolog. Quite amazing! From > Dogelog Player library(math): > > /** > * acyclic_term(T): [TC2 8.3.11] > * The predicate succeeds when the Prolog term T is an acyclic term, > * otherwise the predicate fails. > */ > % acyclic_term(+Term) > acyclic_term(X) :- sys_cyclic_term(X, []), !, fail. > acyclic_term(_). > > % sys_cyclic_term(+Term, +List) > sys_cyclic_term(X, S) :- compound(X), > member(Y, S), > same_term(X, Y), !. > sys_cyclic_term(X, S) :- compound(X), > X =.. [_|L], > member(Y, L), > sys_cyclic_term(Y, [X|S]). > > Algorithms that implicitly detect sharing cannot > do much? Since we only need to find a first cycle? > Also a challenge to bring the association list to > native and lets say turn it into a hash table, > > don't know yet when and how even somebody would > attempt that. Big advantage of anything not using > Deutsch-Schorr-Waite , no write operation into the > given term. Write operation are sometimes > > poison for the CPU and the RAM. > > Bye > > Mild Shock schrieb: >> Hi, >> >> Assume that we live in a world where we >> have excess memory. So we can afford stacks! >> And then make the crucial observation, >> >> we can use the stack of the Prolog engine, >> no need to create an artificial stack in C, >> or use the native stack of C. >> >> I guess SWI-Prolog has already groked the >> first we can "afford stacks". But did anybody >> already grok the "100% Prolog" idea? >> >> Well we are not yet there 100% Prolog >> has still an overhead. Here is a little >> test acyclic_term/2: >> >> /* SWI-Prolog 9.3.26, C Stacks and/or Agendas */ >> ?- time((between(1,30,_), acyclic2, fail; true)). >> % 330,150 inferences, 0.016 CPU in 0.023 seconds >> (69% CPU, 21129600 Lips) >> true. >> >> /* Trealla Prolog 2.79.6, ?? */ >> ?- time((between(1,30,_), acyclic2, fail; true)). >> % Time elapsed 0.063s, 643413 Inferences, 10.166 MLips >> true. >> >> /* Dogelog Player 1.3.5, 100% Prolog */ >> ?- time((between(1,30,_), acyclic2, fail; true)). >> % Zeit 115 ms, GC 0 ms, Lips 11803904, Uhr 28.07.2025 10:03 >> true. >> >> /* Scryer Prolog 0.9.4-417, Deutsch-Schorr-Waite */ >> ?- time((between(1,30,_), acyclic2, fail; true)). >> % CPU time: 0.130s, 626_829 inferences >> true. >> >> Bye >
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-07-28 17:27 +0200 |
| Subject | Cache-Trashing vs Cache-Friendly [Code Example] (Re: Do it like in acyclic_decompose/3) |
| Message-ID | <10684s5$2ud0g$2@solani.org> |
| In reply to | #14743 |
> Write operation are sometimes
> poison for the CPU and the RAM.
Try this where SIZE is a prime number:
/* Cache-Trashing Example */
void column_major_access() {
for (int col = 0; col < SIZE; col++) {
for (int row = 0; row < SIZE; row++) {
matrix[row][col] += 1;
}
}
}
/* Cache-Friendly Example */
void row_major_access() {
for (int row = 0; row < SIZE; row++) {
for (int col = 0; col < SIZE; col++) {
matrix[row][col] += 1;
}
}
}
Mild Shock schrieb:
> Hi,
>
> Interstingly there is an obvious way how
> to do it without a braching association list,
> that has different futures so to speack,
>
> the below code repeatedly generates
> dfferent association lists via [X|S].
> We could of course instead do a threading
>
> of the association list through some predicate,
> and use some state on each entry inside the
> association list, similar like in acyclic_decompose/3
>
> we used a threading and entry state.
>
> Bye
>
> Mild Shock schrieb:
>> Hi,
>>
>> So the 115 ms by Dogelog Player are faster than the
>> 0.130s by Scryer Prolog. Quite amazing! From
>> Dogelog Player library(math):
>>
>> /**
>> * acyclic_term(T): [TC2 8.3.11]
>> * The predicate succeeds when the Prolog term T is an acyclic term,
>> * otherwise the predicate fails.
>> */
>> % acyclic_term(+Term)
>> acyclic_term(X) :- sys_cyclic_term(X, []), !, fail.
>> acyclic_term(_).
>>
>> % sys_cyclic_term(+Term, +List)
>> sys_cyclic_term(X, S) :- compound(X),
>> member(Y, S),
>> same_term(X, Y), !.
>> sys_cyclic_term(X, S) :- compound(X),
>> X =.. [_|L],
>> member(Y, L),
>> sys_cyclic_term(Y, [X|S]).
>>
>> Algorithms that implicitly detect sharing cannot
>> do much? Since we only need to find a first cycle?
>> Also a challenge to bring the association list to
>> native and lets say turn it into a hash table,
>>
>> don't know yet when and how even somebody would
>> attempt that. Big advantage of anything not using
>> Deutsch-Schorr-Waite , no write operation into the
>> given term. Write operation are sometimes
>>
>> poison for the CPU and the RAM.
>>
>> Bye
>>
>> Mild Shock schrieb:
>>> Hi,
>>>
>>> Assume that we live in a world where we
>>> have excess memory. So we can afford stacks!
>>> And then make the crucial observation,
>>>
>>> we can use the stack of the Prolog engine,
>>> no need to create an artificial stack in C,
>>> or use the native stack of C.
>>>
>>> I guess SWI-Prolog has already groked the
>>> first we can "afford stacks". But did anybody
>>> already grok the "100% Prolog" idea?
>>>
>>> Well we are not yet there 100% Prolog
>>> has still an overhead. Here is a little
>>> test acyclic_term/2:
>>>
>>> /* SWI-Prolog 9.3.26, C Stacks and/or Agendas */
>>> ?- time((between(1,30,_), acyclic2, fail; true)).
>>> % 330,150 inferences, 0.016 CPU in 0.023 seconds
>>> (69% CPU, 21129600 Lips)
>>> true.
>>>
>>> /* Trealla Prolog 2.79.6, ?? */
>>> ?- time((between(1,30,_), acyclic2, fail; true)).
>>> % Time elapsed 0.063s, 643413 Inferences, 10.166 MLips
>>> true.
>>>
>>> /* Dogelog Player 1.3.5, 100% Prolog */
>>> ?- time((between(1,30,_), acyclic2, fail; true)).
>>> % Zeit 115 ms, GC 0 ms, Lips 11803904, Uhr 28.07.2025 10:03
>>> true.
>>>
>>> /* Scryer Prolog 0.9.4-417, Deutsch-Schorr-Waite */
>>> ?- time((between(1,30,_), acyclic2, fail; true)).
>>> % CPU time: 0.130s, 626_829 inferences
>>> true.
>>>
>>> Bye
>>
>
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-08-16 13:02 +0200 |
| Subject | Entering the Age of Rational Trees (2025) (Was: The End of Deutsch-Schorr-Waite [cycle_detection.rs]) |
| Message-ID | <107pofb$474d$1@solani.org> |
| In reply to | #14741 |
> I like your vibe, clearing the mind of > everything existing has a touch of a mystic > human being living an eremitic solitary > vocation on a far out mountain top. It is not accidential that there is a resemblage to the ivory tower of academics. Which might create incestual orthodoxical knowledge, with very less value. Prolog systems development is especially susceptible to this fallacy, since it has a long tradition going always the same paths, like WAM, etc.. etc.. The pointer swizzling algorithms of SWI-Prolog, in connection with cyclic terms are a little problematic. What if a Prolog term sits in a read-only memory, or is shared among multiple threads. How do you do pointer swizzling of ROM and not RAM? We might indeed see the The End of Deutsch-Schorr-Waite, although it made it still into Scryer Prolog: > **cycle_detection.rs** Use the pointer reversal technique of the Deutsch-Schorr- Waite algorithm to detect cycles in Prolog terms. https://github.com/mthom/scryer-prolog/blob/master/src/machine/cycle_detection.rs To enter the age of rational trees, it is probably advisable to arm oneself not only with Fuzzy Testing, but unlike the dislike of @kuniaki.mukai , one needs to probably also study all the goodies from 1970's computer science. But add a salt of scepticism, since hardware and programming languages look different now. Its not ALGOL anymore. Mild Shock schrieb: > Hi, > > Assume that we live in a world where we > have excess memory. So we can afford stacks! > And then make the crucial observation, > > we can use the stack of the Prolog engine, > no need to create an artificial stack in C, > or use the native stack of C. > > I guess SWI-Prolog has already groked the > first we can "afford stacks". But did anybody > already grok the "100% Prolog" idea? > > Well we are not yet there 100% Prolog > has still an overhead. Here is a little > test acyclic_term/2: > > /* SWI-Prolog 9.3.26, C Stacks and/or Agendas */ > ?- time((between(1,30,_), acyclic2, fail; true)). > % 330,150 inferences, 0.016 CPU in 0.023 seconds > (69% CPU, 21129600 Lips) > true. > > /* Trealla Prolog 2.79.6, ?? */ > ?- time((between(1,30,_), acyclic2, fail; true)). > % Time elapsed 0.063s, 643413 Inferences, 10.166 MLips > true. > > /* Dogelog Player 1.3.5, 100% Prolog */ > ?- time((between(1,30,_), acyclic2, fail; true)). > % Zeit 115 ms, GC 0 ms, Lips 11803904, Uhr 28.07.2025 10:03 > true. > > /* Scryer Prolog 0.9.4-417, Deutsch-Schorr-Waite */ > ?- time((between(1,30,_), acyclic2, fail; true)). > % CPU time: 0.130s, 626_829 inferences > true. > > Bye
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-08-24 14:44 +0200 |
| Subject | The End of Debray Allocator (Was: The End of Deutsch-Schorr-Waite [cycle_detection.rs]) |
| Message-ID | <108f1eq$hc2m$1@solani.org> |
| In reply to | #14741 |
Hi, While I had an allocator that was reusing slots. But for release 1.3.6 I rejected it, and went back to a different solution. The new solution is more interesting, since it allows to have exec_unify() and exec_build() to be commutative with itself and each other, they do not have to be called in input order anymore. The generated code shows a trait of relocatability consisting of blocks that can be executed in varying order. The following things went out of the window: - Old Take: 3 variable instructions, 1 intruction for annonymous variable, 1 instruction for first variable, 1 instruction for non-first variable. The first variable instruction did the slot reuse via an overwrite. - New Take: 2 variable instructions, 1 instruction for annonymous variable 1 instruction for non-annonymous variable. The non-annonymous variable is clever, uses the state of the slot to dynamically figure out whether it is first or not. We loose slot overwriting. That we cannnot overwrite slots anymore makes the var displays bigger. But unlike in the Debray Allocator for the WAM. The display is not WAM registers, it is more volatile. Only used during neck optimized built-ins and when creating the clause rest. The bigger displays causes a small performance penality, they have to be also initialized particularly to make the algorithm work. But the host programming language allocators do that for us. The extra effort is compensated that we are now more flexible in code generation, and also more flexible in the builtin implementation. As a first result, we removed the '$EVAL'/2 cludge, to compile is/2. Possibly more things are to come. Especially in the domain of static variable shunting. Bye Mild Shock schrieb: > Hi, > > Assume that we live in a world where we > have excess memory. So we can afford stacks! > And then make the crucial observation, > > we can use the stack of the Prolog engine, > no need to create an artificial stack in C, > or use the native stack of C. > > I guess SWI-Prolog has already groked the > first we can "afford stacks". But did anybody > already grok the "100% Prolog" idea? > > Well we are not yet there 100% Prolog > has still an overhead. Here is a little > test acyclic_term/2: > > /* SWI-Prolog 9.3.26, C Stacks and/or Agendas */ > ?- time((between(1,30,_), acyclic2, fail; true)). > % 330,150 inferences, 0.016 CPU in 0.023 seconds > (69% CPU, 21129600 Lips) > true. > > /* Trealla Prolog 2.79.6, ?? */ > ?- time((between(1,30,_), acyclic2, fail; true)). > % Time elapsed 0.063s, 643413 Inferences, 10.166 MLips > true. > > /* Dogelog Player 1.3.5, 100% Prolog */ > ?- time((between(1,30,_), acyclic2, fail; true)). > % Zeit 115 ms, GC 0 ms, Lips 11803904, Uhr 28.07.2025 10:03 > true. > > /* Scryer Prolog 0.9.4-417, Deutsch-Schorr-Waite */ > ?- time((between(1,30,_), acyclic2, fail; true)). > % CPU time: 0.130s, 626_829 inferences > true. > > Bye
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-07-30 14:45 +0200 |
| Subject | The pairs are nasty, otherwise not always slow! (Re: Novacore goes Bisimulation: Scryer Prolog is Slow!) |
| Message-ID | <106d459$33hel$3@solani.org> |
| In reply to | #14729 |
Hi,
Looks like the pairs are really nasty.
I have them on the Novacore GIT.
This one is no problem for Scryer-Prolog:
test :-
share(X), share(Y), X == Y.
/* SWI-Prolog 9.3.26 */
?- time(test).
% 32,140 inferences, 0.000 CPU in 0.002 seconds (0% CPU, Infinite Lips)
true.
/* Scryer Prolog 0.9.4-417 */
?- time(test).
% CPU time: 0.006s, 32_042 inferences
true.
/* Trealla Prolog 2.79.6 */
?- time(test).
% Time elapsed 0.016s, 42012 Inferences, 2.582 MLips
true.
/* Dogelog Player 1.3.5 */
?- time(test2).
% % Zeit 83 ms, GC 0 ms, Lips 12117469, Uhr 30.07.2025 05:47
% true.
The Dogelog Player solutions uses a variant
of library(hash), called library(maps).
Both hash tables are itself 100% Prolog.
Bye
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
>
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-07-30 14:51 +0200 |
| Subject | It was painful for my GC, but fixed now (Re: The pairs are nasty, otherwise not always slow!) |
| Message-ID | <106d4fs$33hjf$3@solani.org> |
| In reply to | #14745 |
Hi,
The sharing example was painful for my GC.
I got a long GC pause:
/* Dogelog Player 1.3.5 for JavaScript */
?- time((share(X), acyclic3(X), fail; true)).
% Zeit 122 ms, GC 0 ms, Lips 4906262, Uhr 30.07.2025 04:54
true.
?- time((share(X), acyclic3(X), fail; true)).
% Zeit 445 ms, GC 313 ms, Lips 1345087, Uhr 30.07.2025 04:54
true.
But fixed now:
/* Dogelog Player 1.3.5 for JavaScript */
?- time((share(X), acyclic3(X), fail; true)).
% Zeit 125 ms, GC 7 ms, Lips 4788512, Uhr 30.07.2025 09:11
true.
Here is share/1, the idea is to have some
deep term, and share it widely:
share(L) :-
fac(s(s(s(s(s(s(s(n))))))), X),
length(L, 5000),
maplist(=(X), L).
With usual peano arithmetic. n/0 stands for
null, and s/1 for successor:
add(n, X, X).
add(s(X), Y, Z) :- add(X, s(Y), Z).
mul(n, _, n).
mul(s(X), Y, Z) :- mul(X, Y, H), add(Y, H, Z).
fac(n, s(n)).
fac(s(X), Y) :- fac(X, H), mul(s(X), H, Y).
Mild Shock schrieb:
> Hi,
>
> Looks like the pairs are really nasty.
> I have them on the Novacore GIT.
>
> This one is no problem for Scryer-Prolog:
>
> test :-
> share(X), share(Y), X == Y.
>
> /* SWI-Prolog 9.3.26 */
> ?- time(test).
> % 32,140 inferences, 0.000 CPU in 0.002 seconds (0% CPU, Infinite Lips)
> true.
>
> /* Scryer Prolog 0.9.4-417 */
> ?- time(test).
> % CPU time: 0.006s, 32_042 inferences
> true.
>
> /* Trealla Prolog 2.79.6 */
> ?- time(test).
> % Time elapsed 0.016s, 42012 Inferences, 2.582 MLips
> true.
>
> /* Dogelog Player 1.3.5 */
> ?- time(test2).
> % % Zeit 83 ms, GC 0 ms, Lips 12117469, Uhr 30.07.2025 05:47
> % true.
>
> The Dogelog Player solutions uses a variant
> of library(hash), called library(maps).
> Both hash tables are itself 100% Prolog.
>
> Bye
>
> 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
>>
>
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-08-02 13:43 +0200 |
| Subject | Scryer Prolog has the most useless max_depth (Re: Novacore goes Bisimulation: Scryer Prolog is Slow!) |
| Message-ID | <106ktkr$38lbm$1@solani.org> |
| In reply to | #14729 |
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
>
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2025-08-02 14:45 +0200 |
| Subject | Novacore goes native (=)/2 and (==)/2 bisimulation (Was: Scryer Prolog has the most useless max_depth) |
| Message-ID | <106l19p$3648u$1@solani.org> |
| In reply to | #14750 |
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
>>
>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.prolog
csiph-web