• WebPL is already outdated

    From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Sun Aug 17 18:37:07 2025
    From Newsgroup: comp.lang.prolog

    Hi,

    WebPL is already outdated I guess. It doesn't
    show the versions of the other Prolog systems
    it is using. While I had these results for

    the primes example in the WebPL playground:

    /* Trealla Prolog WASM */
    (23568.9ms)

    When I run the example here:

    https://php.energy/trealla.html

    I get better results:

    /* trealla-js 0.27.1 */

    ?- time(test).
    % Time elapsed 9.907s, 11263917 Inferences, 1.137 MLips

    Bye
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Mon Aug 18 14:52:50 2025
    From Newsgroup: comp.lang.prolog

    Hi,

    Heap/Stack Prolog systems could solve some Prolog
    String Problems, especially in connection with a FFI, but I am
    not showing that. More a general design limitation of the common

    take of WAM resp. ZIP. The new WebPL Prolog describes itself as a
    merged Heap/Stack architecture Prolog system. And has a reference
    in its escorting paper to an academic work by Xining Li (1999):

    A new term representation method for prolog
    Xining Li - 1999 https://www.sciencedirect.com/science/article/pii/S0743106697000629

    Besides that Program Sharing (PS), as it is called in the paper,
    is nothing new, WebPL also shows a more modern take, in that
    it already uses compound data types from Rust. Can we

    replicate some of the performance advantages of a PS system
    versus the more traditional WAM resp. ZIP based systems? Here
    is a simple test in the WebPL Playground, for Web PL without GC:

    /* WebPL NoGC */
    ?- test2(10).
    (1795.6ms)

    ?- test2(30).
    (1785.5ms)

    ?- test2(90).
    (1765.6ms)
    Then SWI-Prolog WASM as found in SWI-Tinker:

    /* SWI-Prolog WASM */
    ?- test2(10).
    (1239.3ms)

    ?- test2(30).
    (2276.1ms)

    ?- test2(90).
    (5372.3ms)

    https://webpl.whenderson.dev/

    Bye

    The test case:

    data(10, [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]).

    data(30, [30, 29, 28, 27, 26, 25, 24, 23,
    22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
    12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]).

    data(90, [90, 89, 88, 87, 86, 85, 84, 83,
    82, 81, 80, 79, 78, 77, 76, 75, 74, 73,
    72, 71, 70, 69, 68, 67, 66, 65, 64, 63,
    62, 61, 60, 59, 58, 57, 56, 55, 54, 53,
    52, 51, 50, 49, 48, 47, 46, 45, 44, 43,
    42, 41, 40, 39, 38, 37, 36, 35, 34, 33,
    32, 31, 30, 29, 28, 27, 26, 25, 24, 23,
    22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
    12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]).

    test(N) :- between(1,1000,_), data(N,_), fail.
    test(_).

    test2(N) :- between(1,1000,_), test(N), fail.
    test2(_).

    between(Lo, Lo, R) :- !, Lo = R.
    between(Lo, _, Lo).
    between(Lo, Hi, X) :- Lo2 is Lo+1, between(Lo2, Hi, X).



    Mild Shock schrieb:
    Hi,

    WebPL is already outdated I guess. It doesn't
    show the versions of the other Prolog systems
    it is using. While I had these results for

    the primes example in the WebPL playground:

    /* Trealla Prolog WASM */
    (23568.9ms)

    When I run the example here:

    https://php.energy/trealla.html

    I get better results:

    /* trealla-js 0.27.1 */

    ?- time(test).
    % Time elapsed 9.907s, 11263917 Inferences, 1.137 MLips

    Bye

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Mon Aug 18 15:06:39 2025
    From Newsgroup: comp.lang.prolog

    Hi,

    Ok lets run the test case on the desktop,
    and not on the web. What do we get? Its almost
    constant for Trealla Prolog as well, in

    WebPL it was perfectly constant, but here
    its only almost constant:

    /* Trealla Prolog 2.82.14 */

    ?- time(test2(10)).
    % Time elapsed 0.188s, 3004002 Inferences, 16.014 MLips
    true.

    ?- time(test2(30)).
    % Time elapsed 0.210s, 3004002 Inferences, 14.321 MLips
    true.

    ?- time(test2(90)).
    % Time elapsed 0.228s, 3004002 Inferences, 13.147 MLips
    true.

    Scryer Prolog fails the test horribly. Which
    is amazing, since it is a Rust Prolog system just
    like WebPL. But they are too traditional in

    following the stupid WAM design:

    /* Scryer Prolog 0.9.4-599 */

    ?- time(test2(10)).
    % CPU time: 0.714s, 7_049_076 inferences
    true.

    ?- time(test2(30)).
    % CPU time: 1.284s, 7_049_099 inferences
    true.

    ?- time(test2(90)).
    % CPU time: 2.984s, 7_049_099 inferences
    true.

    Bye

    Mild Shock schrieb:
    Hi,

    Heap/Stack Prolog systems could solve some Prolog
    String Problems, especially in connection with a FFI, but I am
    not showing that. More a general design limitation of the common

    take of WAM resp. ZIP. The new WebPL Prolog describes itself as a
    merged Heap/Stack architecture Prolog system. And has a reference
    in its escorting paper to an academic work by Xining Li (1999):

    A new term representation method for prolog
    Xining Li - 1999 https://www.sciencedirect.com/science/article/pii/S0743106697000629

    Besides that Program Sharing (PS), as it is called in the paper,
    is nothing new, WebPL also shows a more modern take, in that
    it already uses compound data types from Rust. Can we

    replicate some of the performance advantages of a PS system
    versus the more traditional WAM resp. ZIP based systems? Here
    is a simple test in the WebPL Playground, for Web PL without GC:

    /* WebPL NoGC */
    ?- test2(10).
    (1795.6ms)

    ?- test2(30).
    (1785.5ms)

    ?- test2(90).
    (1765.6ms)
    Then SWI-Prolog WASM as found in SWI-Tinker:

    /* SWI-Prolog WASM */
    ?- test2(10).
    (1239.3ms)

    ?- test2(30).
    (2276.1ms)

    ?- test2(90).
    (5372.3ms)

    https://webpl.whenderson.dev/

    Bye

    The test case:

    data(10, [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]).

    data(30, [30, 29, 28, 27, 26, 25, 24, 23,
       22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
       12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]).

    data(90, [90, 89, 88, 87, 86, 85, 84, 83,
       82, 81, 80, 79, 78, 77, 76, 75, 74, 73,
       72, 71, 70, 69, 68, 67, 66, 65, 64, 63,
       62, 61, 60, 59, 58, 57, 56, 55, 54, 53,
       52, 51, 50, 49, 48, 47, 46, 45, 44, 43,
       42, 41, 40, 39, 38, 37, 36, 35, 34, 33,
       32, 31, 30, 29, 28, 27, 26, 25, 24, 23,
       22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
       12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]).

    test(N) :- between(1,1000,_), data(N,_), fail.
    test(_).

    test2(N) :- between(1,1000,_), test(N), fail.
    test2(_).

    between(Lo, Lo, R) :- !, Lo = R.
    between(Lo, _, Lo).
    between(Lo, Hi, X) :- Lo2 is Lo+1, between(Lo2, Hi, X).



    Mild Shock schrieb:
    Hi,

    WebPL is already outdated I guess. It doesn't
    show the versions of the other Prolog systems
    it is using. While I had these results for

    the primes example in the WebPL playground:

    /* Trealla Prolog WASM */
    (23568.9ms)

    When I run the example here:

    https://php.energy/trealla.html

    I get better results:

    /* trealla-js 0.27.1 */

    ?- time(test).
    % Time elapsed 9.907s, 11263917 Inferences, 1.137 MLips

    Bye


    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Mon Aug 18 15:42:38 2025
    From Newsgroup: comp.lang.prolog

    Hi,

    Smarter Partial Strings would use Program
    Sharing. Take the invention of Scryer
    Prolog and think about it from a Program

    Sharing prespective:

    p --> "abc", q

    Translates to with Partial Strings:

    p(C, B) :- C = "abc"||A, q(A, B).

    Unfortunately straight forward Program
    Sharning of the partial string doesn't
    work anymore, since it is not ground:

    p(C, B) :- C = [a,b,c|A], q(A, B).

    But we could translate the DCG also to:

    p(C, B) :- '$append'([a,b,c],A,C), q(A, B).

    Where '$append'/3 is a mode (+,-,-) specialization
    of append/3. Could be natively implemented.
    The mode (+,-,-) will be more clever

    then the failed programm sharing. The program
    sharing can share the string "abc", since with
    '$append'/3, the DCG is basically:

    p(C, B) :- '$append'("abc",A,C), q(A, B).

    Now '$append'/3 would do a copying of the string,
    if A is unbound, this is usually the "DCG used for
    text generation" mode. But if A is bound, the

    '$append'/3 would not do some copying, but it
    would actually match the prefix. So it gives
    a much better DCG for parsing, since this is

    "DCG used for text parsing" mode.

    Bye

    Mild Shock schrieb:
    Hi,

    Ok lets run the test case on the desktop,
    and not on the web. What do we get? Its almost
    constant for Trealla Prolog as well, in

    WebPL it was perfectly constant, but here
    its only almost constant:

    /* Trealla Prolog 2.82.14 */

    ?- time(test2(10)).
    % Time elapsed 0.188s, 3004002 Inferences, 16.014 MLips
       true.

    ?- time(test2(30)).
    % Time elapsed 0.210s, 3004002 Inferences, 14.321 MLips
       true.

    ?- time(test2(90)).
    % Time elapsed 0.228s, 3004002 Inferences, 13.147 MLips
       true.

    Scryer Prolog fails the test horribly. Which
    is amazing, since it is a Rust Prolog system just
    like WebPL. But they are too traditional in

    following the stupid WAM design:

    /* Scryer Prolog 0.9.4-599 */

    ?- time(test2(10)).
       % CPU time: 0.714s, 7_049_076 inferences
       true.

    ?- time(test2(30)).
       % CPU time: 1.284s, 7_049_099 inferences
       true.

    ?- time(test2(90)).
       % CPU time: 2.984s, 7_049_099 inferences
       true.

    Bye

    Mild Shock schrieb:
    Hi,

    Heap/Stack Prolog systems could solve some Prolog
    String Problems, especially in connection with a FFI, but I am
    not showing that. More a general design limitation of the common

    take of WAM resp. ZIP. The new WebPL Prolog describes itself as a
    merged Heap/Stack architecture Prolog system. And has a reference
    in its escorting paper to an academic work by Xining Li (1999):

    A new term representation method for prolog
    Xining Li - 1999
    https://www.sciencedirect.com/science/article/pii/S0743106697000629

    Besides that Program Sharing (PS), as it is called in the paper,
    is nothing new, WebPL also shows a more modern take, in that
    it already uses compound data types from Rust. Can we

    replicate some of the performance advantages of a PS system
    versus the more traditional WAM resp. ZIP based systems? Here
    is a simple test in the WebPL Playground, for Web PL without GC:

    /* WebPL NoGC */
    ?- test2(10).
    (1795.6ms)

    ?- test2(30).
    (1785.5ms)

    ?- test2(90).
    (1765.6ms)
    Then SWI-Prolog WASM as found in SWI-Tinker:

    /* SWI-Prolog WASM */
    ?- test2(10).
    (1239.3ms)

    ?- test2(30).
    (2276.1ms)

    ?- test2(90).
    (5372.3ms)

    https://webpl.whenderson.dev/

    Bye

    The test case:

    data(10, [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]).

    data(30, [30, 29, 28, 27, 26, 25, 24, 23,
        22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
        12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]).

    data(90, [90, 89, 88, 87, 86, 85, 84, 83,
        82, 81, 80, 79, 78, 77, 76, 75, 74, 73,
        72, 71, 70, 69, 68, 67, 66, 65, 64, 63,
        62, 61, 60, 59, 58, 57, 56, 55, 54, 53,
        52, 51, 50, 49, 48, 47, 46, 45, 44, 43,
        42, 41, 40, 39, 38, 37, 36, 35, 34, 33,
        32, 31, 30, 29, 28, 27, 26, 25, 24, 23,
        22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
        12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]).

    test(N) :- between(1,1000,_), data(N,_), fail.
    test(_).

    test2(N) :- between(1,1000,_), test(N), fail.
    test2(_).

    between(Lo, Lo, R) :- !, Lo = R.
    between(Lo, _, Lo).
    between(Lo, Hi, X) :- Lo2 is Lo+1, between(Lo2, Hi, X).



    Mild Shock schrieb:
    Hi,

    WebPL is already outdated I guess. It doesn't
    show the versions of the other Prolog systems
    it is using. While I had these results for

    the primes example in the WebPL playground:

    /* Trealla Prolog WASM */
    (23568.9ms)

    When I run the example here:

    https://php.energy/trealla.html

    I get better results:

    /* trealla-js 0.27.1 */

    ?- time(test).
    % Time elapsed 9.907s, 11263917 Inferences, 1.137 MLips

    Bye



    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Mon Aug 18 15:49:54 2025
    From Newsgroup: comp.lang.prolog

    Hi,

    In Dogelog Player I don't need to introduce
    '$append'/3, since in this code there is
    anyway an attempt to do static shunting:

    p(C, B) :- C = [a,b,c|A], q(A, B).

    It is handled as if it were:

    p([a,b,c|A], B) :- q(A, B).

    This means [a,b,c|A] is anyway program shared (PS),
    and a matching happens so that we can ultimately
    omit the creation of a real Prolog variable for

    A. It will get a special place holder that is
    not trailed. Maybe I will find a test case
    to illustrate this form of program sharing,

    which I have temporarily termed static shunting,
    whereas WebPL paper shunting, I would rather
    call dynamic shunting. Unfortuantely WebPL

    does not support DCG parsing, the (-->)/2
    clauses don't work. So will take me more time
    to test whether there is something in WebPL,

    concerning this type of program sharing as well,
    or whether it was botched.

    Bye

    Mild Shock schrieb:
    Hi,

    Smarter Partial Strings would use Program
    Sharing. Take the invention of Scryer
    Prolog and think about it from a Program

    Sharing prespective:

    p --> "abc", q

    Translates to with Partial Strings:

    p(C, B) :- C = "abc"||A, q(A, B).

    Unfortunately straight forward Program
    Sharning of the partial string doesn't
    work anymore, since it is not ground:

    p(C, B) :- C = [a,b,c|A], q(A, B).

    But we could translate the DCG also to:

    p(C, B) :- '$append'([a,b,c],A,C), q(A, B).

    Where '$append'/3 is a mode (+,-,-) specialization
    of append/3. Could be natively implemented.
    The mode (+,-,-) will be more clever

    then the failed programm sharing. The program
    sharing can share the string "abc", since with
    '$append'/3, the DCG is basically:

    p(C, B) :- '$append'("abc",A,C), q(A, B).

    Now '$append'/3 would do a copying of the string,
    if A is unbound, this is usually the "DCG used for
    text generation" mode. But if A is bound, the

    '$append'/3 would not do some copying, but it
    would actually match the prefix. So it gives
    a much better DCG for parsing, since this is

    "DCG used for text parsing" mode.

    Bye

    Mild Shock schrieb:
    Hi,

    Ok lets run the test case on the desktop,
    and not on the web. What do we get? Its almost
    constant for Trealla Prolog as well, in

    WebPL it was perfectly constant, but here
    its only almost constant:

    /* Trealla Prolog 2.82.14 */

    ?- time(test2(10)).
    % Time elapsed 0.188s, 3004002 Inferences, 16.014 MLips
        true.

    ?- time(test2(30)).
    % Time elapsed 0.210s, 3004002 Inferences, 14.321 MLips
        true.

    ?- time(test2(90)).
    % Time elapsed 0.228s, 3004002 Inferences, 13.147 MLips
        true.

    Scryer Prolog fails the test horribly. Which
    is amazing, since it is a Rust Prolog system just
    like WebPL. But they are too traditional in

    following the stupid WAM design:

    /* Scryer Prolog 0.9.4-599 */

    ?- time(test2(10)).
        % CPU time: 0.714s, 7_049_076 inferences
        true.

    ?- time(test2(30)).
        % CPU time: 1.284s, 7_049_099 inferences
        true.

    ?- time(test2(90)).
        % CPU time: 2.984s, 7_049_099 inferences
        true.

    Bye

    Mild Shock schrieb:
    Hi,

    Heap/Stack Prolog systems could solve some Prolog
    String Problems, especially in connection with a FFI, but I am
    not showing that. More a general design limitation of the common

    take of WAM resp. ZIP. The new WebPL Prolog describes itself as a
    merged Heap/Stack architecture Prolog system. And has a reference
    in its escorting paper to an academic work by Xining Li (1999):

    A new term representation method for prolog
    Xining Li - 1999
    https://www.sciencedirect.com/science/article/pii/S0743106697000629

    Besides that Program Sharing (PS), as it is called in the paper,
    is nothing new, WebPL also shows a more modern take, in that
    it already uses compound data types from Rust. Can we

    replicate some of the performance advantages of a PS system
    versus the more traditional WAM resp. ZIP based systems? Here
    is a simple test in the WebPL Playground, for Web PL without GC:

    /* WebPL NoGC */
    ?- test2(10).
    (1795.6ms)

    ?- test2(30).
    (1785.5ms)

    ?- test2(90).
    (1765.6ms)
    Then SWI-Prolog WASM as found in SWI-Tinker:

    /* SWI-Prolog WASM */
    ?- test2(10).
    (1239.3ms)

    ?- test2(30).
    (2276.1ms)

    ?- test2(90).
    (5372.3ms)

    https://webpl.whenderson.dev/

    Bye

    The test case:

    data(10, [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]).

    data(30, [30, 29, 28, 27, 26, 25, 24, 23,
        22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
        12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]).

    data(90, [90, 89, 88, 87, 86, 85, 84, 83,
        82, 81, 80, 79, 78, 77, 76, 75, 74, 73,
        72, 71, 70, 69, 68, 67, 66, 65, 64, 63,
        62, 61, 60, 59, 58, 57, 56, 55, 54, 53,
        52, 51, 50, 49, 48, 47, 46, 45, 44, 43,
        42, 41, 40, 39, 38, 37, 36, 35, 34, 33,
        32, 31, 30, 29, 28, 27, 26, 25, 24, 23,
        22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
        12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]).

    test(N) :- between(1,1000,_), data(N,_), fail.
    test(_).

    test2(N) :- between(1,1000,_), test(N), fail.
    test2(_).

    between(Lo, Lo, R) :- !, Lo = R.
    between(Lo, _, Lo).
    between(Lo, Hi, X) :- Lo2 is Lo+1, between(Lo2, Hi, X).



    Mild Shock schrieb:
    Hi,

    WebPL is already outdated I guess. It doesn't
    show the versions of the other Prolog systems
    it is using. While I had these results for

    the primes example in the WebPL playground:

    /* Trealla Prolog WASM */
    (23568.9ms)

    When I run the example here:

    https://php.energy/trealla.html

    I get better results:

    /* trealla-js 0.27.1 */

    ?- time(test).
    % Time elapsed 9.907s, 11263917 Inferences, 1.137 MLips

    Bye




    --- Synchronet 3.21a-Linux NewsLink 1.2