Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.prolog > #15459

Does Variable Age make Sense? [Prolog Unification] (Was: Head to Head Race with Scryer Prolog)

From Mild Shock <janburse@fastmail.fm>
Newsgroups comp.lang.prolog
Subject Does Variable Age make Sense? [Prolog Unification] (Was: Head to Head Race with Scryer Prolog)
Date 2026-02-10 12:05 +0100
Message-ID <10mf3dh$j9go$1@solani.org> (permalink)
References (3 earlier) <107pik3$4csp$1@solani.org> <107pjag$4dc8$1@solani.org> <107pk1o$4e0v$1@solani.org> <107sua1$69ve$1@solani.org> <107svnd$6b13$1@solani.org>

Show all headers | View raw


Hi,

The WebPL shunting experiment still resonates. Dogelog
Players assumption is implicit shunting through
unification variable bind preferences, derived

from how unification is called. So I rearranged
the implementation of member/2 a little bit, and
now I get, a less invasive version, doesn't modify L:

/* Dogelog Player 2.1.5 Preview */

/* Not Invasive */
?- T = T, L = [X,Y,Z], member(T, L), write(L), nl, fail; true.
[_0, _1, _2]
[_0, _1, _2]
[_0, _1, _2]
true.

/* Not Invasive */
?- L = [X,Y,Z], T = T, member(T, L), write(L), nl, fail; true.
[_3, _4, _5]
[_3, _4, _5]
[_3, _4, _5]
true.

We can compare with SWI-Prolog:

/* SWI-Prolog 10.1.1 */
/* Invasive */
?- T = T, L = [X,Y,Z], member(T, L), write(L), nl, fail; true.
[_13280,_13294,_13300]
[_13288,_13280,_13300]
[_13288,_13294,_13280]
true.

/* Not Invasive */
?- L = [X,Y,Z], T = T, member(T, L), write(L), nl, fail; true.
[_18762,_18768,_18774]
[_18762,_18768,_18774]
[_18762,_18768,_18774]
true.

And the result for Scryer Prolog:

/* Scryer Prolog 0.10 */
/* Invasive */
?- T = T, L = [X,Y,Z], member(T, L), write(L), nl, fail; true.
[_112,_131,_138]
[_123,_112,_138]
[_123,_131,_112]
    true.

/* Invasive */
?- L = [X,Y,Z], T = T, member(T, L), write(L), nl, fail; true.
[_117,_125,_133]
[_117,_120,_133]
[_117,_125,_120]
    true.

Bye

Mild Shock schrieb:
> Hi,
> 
> Here some test results when testing
> Desktop and not the Web. With Desktop
> Prolog versions I find:
> 
> /* SWI-Prolog 9.3.28 */
> % 7,506,637 inferences, 0.578 CPU in 0.567 seconds
> 
> /* Dogelog Player 1.3.6 for Java (16.08.2025) */
> % Zeit 803 ms, GC 0 ms, Lips 9367988, Uhr 17.08.2025 18:03
> 
> /* Scryer Prolog 0.9.4-592 */
> % CPU time: 0.838s, 7_517_613 inferences
> 
> /* Trealla Prolog 2.82.12 */
> % Time elapsed 2.315s, 11263917 Inferences, 4.866 MLips
> 
> Bye
> 
> Mild Shock schrieb:
>> Hi,
>>
>> The paper by Shalin and Carlson from 1991
>> did not yet ring a bell. But it suggest testing
>> something with primes and freeze. Lets do
>>
>> primes as suggested but without freeze. SWI-Prolog
>> seems not to the OG of GC. Putting aside Shalin
>> and Carlson, its an typical example of a lot of
>>
>> intermediate results, that can be discarded by
>> a garbage collection. Every candidate number that
>> is not a prime number can be remove from the
>>
>> trail they get unreachable in the first clause
>> of search/3. Besides this obvious unreachability
>> task, I don't have statistics or don't see immediately
>>
>> where large variable instantiation chains are supposed
>> to be created. At least not in my Prolog system, since
>> a result variable is passed without binding it to a
>>
>> local variable, this "shunting" happens independent
>> of neck tests and the "shunting" there. The result variable
>> passing is extremly simple to implement and could
>>
>> be what is effective here besides the reachability thingy.
>> At least the 1 ms GC time in Dogelog Player show that
>> the reachability thingy is the minor effort or optimization
>>
>> to get nice performance:
>>
>>
>> /* WebPL GC */
>> (1846.1ms)
>>
>> /* Dogelog Player 1.3.6 for JavaScript (16.08.2025) */
>> % Zeit 2992 ms, GC 1 ms, Lips 2514202, Uhr 17.08.2025 17:44
>>
>> /* SWI-Prolog WASM */
>> (4204.2ms)
>>
>> /* Trealla Prolog WASM */
>> (23568.9ms)
>>
>> The test code was:
>>
>> test :-
>>     len(L, 1000),
>>     primes(L, _).
>>
>> primes([], 1).
>> primes([J|L], J) :-
>>     primes(L, I),
>>     K is I+1,
>>     search(L, K, J).
>>
>> search(L, I, J) :-
>>     mem(X, L),
>>     I mod X =:= 0, !,
>>     K is I+1,
>>     search(L, K, J).
>> search(_, I, I).
>>
>> mem(X, [X|_]).
>> mem(X, [_|Y]) :-
>>     mem(X, Y).
>>
>> len([], 0) :- !.
>> len([_|L], N) :-
>>     N > 0,
>>     M is N-1,
>>     len(L, M).
>>
>> Bye
> 

Back to comp.lang.prolog | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Prolog Education Group clueless about the AI Boom? Mild Shock <janburse@fastmail.fm> - 2025-03-03 14:18 +0100
  Re: Prolog Education Group clueless about the AI Boom? Mild Shock <janburse@fastmail.fm> - 2025-03-03 14:20 +0100
    Salary Templates if you "Grok" ML / AI [PhDs Negotiate Salaries] (Re: Prolog Education Group clueless about the AI Boom?) Mild Shock <janburse@fastmail.fm> - 2025-03-03 18:03 +0100
  ILP is still dreaming of higher order (Was: Prolog Education Group clueless about the AI Boom?) Mild Shock <janburse@fastmail.fm> - 2025-03-07 23:58 +0100
    Re: ILP is still dreaming of higher order (Was: Prolog Education Group clueless about the AI Boom?) Mild Shock <janburse@fastmail.fm> - 2025-03-08 00:00 +0100
  FYI: Philip Zucker’s Co-Egraphs (Was: Prolog Education Group clueless about the AI Boom?) Mild Shock <janburse@fastmail.fm> - 2025-08-12 18:37 +0200
    Using Hopcroft & Karp (HK) everywhere (Was: FYI: Philip Zucker’s Co-Egraphs) Mild Shock <janburse@fastmail.fm> - 2025-08-14 12:31 +0200
      Confusing "decidable problem" and "complete algorithm" (Was: Using Hopcroft & Karp (HK) everywhere) Mild Shock <janburse@fastmail.fm> - 2025-08-14 14:31 +0200
        DFA algorithms in a Python library (Re: Confusing "decidable problem" and "complete algorithm") Mild Shock <janburse@fastmail.fm> - 2025-08-14 15:14 +0200
      Static Variable Shunting in Dogelog Player (Was: Using Hopcroft & Karp (HK) everywhere) Mild Shock <janburse@fastmail.fm> - 2025-08-16 11:22 +0200
        Dynamic Variable Shunting in WebPL (Was: Static Variable Shunting in Dogelog Player) Mild Shock <janburse@fastmail.fm> - 2025-08-16 11:34 +0200
          SWI-Prolog is still the OG of GC (Was: Dynamic Variable Shunting in WebPL) Mild Shock <janburse@fastmail.fm> - 2025-08-16 11:46 +0200
            Cyclic Term Unification is Accounted (Was: SWI-Prolog is still the OG of GC) Mild Shock <janburse@fastmail.fm> - 2025-08-16 11:59 +0200
            WebPL is an interesting project (Was: SWI-Prolog is still the OG of GC) Mild Shock <janburse@fastmail.fm> - 2025-08-17 18:00 +0200
              Head to Head Race with Scryer Prolog (Was: WebPL is an interesting project) Mild Shock <janburse@fastmail.fm> - 2025-08-17 18:24 +0200
                Does Variable Age make Sense? [Prolog Unification] (Was: Head to Head Race with Scryer Prolog) Mild Shock <janburse@fastmail.fm> - 2026-02-10 12:05 +0100
                Type systems for non-deterministic concurrency [Amir Pnueli] (Was: Does Variable Age make Sense? [Prolog Unification]) Mild Shock <janburse@fastmail.fm> - 2026-07-20 12:20 +0200
                Robin Milners fickle gives non-determinism in practice [Parallel π-WAM] (Was: Type systems for non-deterministic concurrency [Amir Pnueli]) Mild Shock <janburse@fastmail.fm> - 2026-07-20 12:34 +0200
  Sleepy Joe and the Poor South (Local AI Emacs Mode) (Re: Prolog Education Group clueless about the AI Boom?) Mild Shock <janburse@fastmail.fm> - 2025-11-12 12:59 +0100
    Beyond Sleepy Joe around the World (Was: Sleepy Joe and the Poor South (Local AI Emacs Mode)) Mild Shock <janburse@fastmail.fm> - 2025-11-12 13:12 +0100
  GENESIS MISSION: Loosing it over Deep Pokets [Business wants A-Life] (Was: Prolog Education Group clueless about the AI Boom?) Mild Shock <janburse@fastmail.fm> - 2025-11-26 18:07 +0100
  Vanilla Prolog: semi-decidable =\= decidable (Re: Prolog Education Group clueless about the AI Boom?) Mild Shock <janburse@fastmail.fm> - 2026-03-14 20:40 +0100
    Its on the Internet, so it must be true? (Was: Vanilla Prolog: semi-decidable =\= decidable) Mild Shock <janburse@fastmail.fm> - 2026-03-16 11:01 +0100
    Hack + Computed Goto = Leightweigh C_OR (Was: Vanilla Prolog: semi-decidable =\= decidable) Mild Shock <janburse@fastmail.fm> - 2026-07-04 16:58 +0200
      The stack and choice points as an after match (Re: Hack + Computed Goto = Leightweigh C_OR) Mild Shock <janburse@fastmail.fm> - 2026-07-04 17:07 +0200
        Introduction to AI Accelerator Prolog [π-WAM of Dogelog] (Was: The stack and choice points as an after match) Mild Shock <janburse@fastmail.fm> - 2026-07-17 10:49 +0200
          Not praying to the god of lambda calculus [π beats α] (Was: Introduction to AI Accelerator Prolog [π-WAM of Dogelog]) Mild Shock <janburse@fastmail.fm> - 2026-07-17 11:13 +0200
          pi in pi-WAM refers to pi-calculus (Re: Introduction to AI Accelerator Prolog [π-WAM of Dogelog]) Mild Shock <janburse@fastmail.fm> - 2026-07-18 01:22 +0200
            Milners fickle() in pi-WAM [For fun and profit] (Re: pi in pi-WAM refers to pi-calculus (Re: Introduction to AI Accelerator Prolog [π-WAM of Dogelog]) Mild Shock <janburse@fastmail.fm> - 2026-07-18 01:49 +0200
              Robin Milners pi calculus is typeless (Re: Milners fickle() in pi-WAM [For fun and profit]) Mild Shock <janburse@fastmail.fm> - 2026-07-18 11:00 +0200
                Can the Church Turing hypotheses be refuted? [TLo @ FOM] (Re: Robin Milners pi calculus is typeless) Mild Shock <janburse@fastmail.fm> - 2026-07-18 11:10 +0200
          Accelerate Lean! From Theorem 3.11 to Corollary 3.12 [ZMC] (Was: Introduction to AI Accelerator Prolog [π-WAM of Dogelog]) Mild Shock <janburse@fastmail.fm> - 2026-07-19 16:06 +0200
            ANN: Library Pegg, for π-E-graphs [Not EXWM] (Was: Accelerate Lean! From Theorem 3.11 to Corollary 3.12 [ZMC]) Mild Shock <janburse@fastmail.fm> - 2026-07-19 16:21 +0200

csiph-web