🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.logic
Article #1674

Is Picat the new WASM King? (Re: Why has SWI become a slow poke Prolog System?)

#1674
From: Mild Shock
Date: Sat, 28 Nov 2026 17:44
142 lines
4379 bytes
Hi,

I got these quite amazing results:

% Picat https://brainsignals.de/picat/

% main => basel(1000,F), write(F), nl.
% 1.64472519023867

% main => between(1,100,_), basel(1000,_), fail; true.
% [finished in 111 ms, status 1]

The 111 ms, are between Dogelog Player (Java
Standalone) with 621.791 ms and Shumway
(C# Standalone) with 0.297 seconds.

Super super amazing!

Bye

Test code Picat:

% sieve(+Integer, +Integer, +List, -List)
sieve(N, M, L, L) :- N > M, !.
sieve(N, M, L, R) :-
    member(X, L),
    N mod X =:= 0, !,
    J is N+1,
    sieve(J, M, L, R).
sieve(N, M, L, R) :-
    J is N+1,
    sieve(J, M, [N|L], R).

% basel(+Integer, -Float)
basel(M, R) :-
    sieve(3, M, [2], L),
    F = 1.0,
    foreach (K in L)
         F := euler(K, F)
    end,
    R = F.

% euler(+Integer, +Float, -Float)
euler(K, I) = I * K**2 / (K**2 - 1.0).

Test Code ordinary Prolog:

% basel(+Integer, -Float)
basel(M, F) :-
    sieve(3, M, [2], L),
    foldl(euler, L, 1, F).

% euler(+Integer, +Float, -Float)
euler(K, I, O) :-
    O is I*K^2/(K^2-1).

Mild Shock schrieb:
> Hi,
> 
> Amazing how Trealla has gained speed!
> 
> /* SWI-Prolog 10.1.18 */
> ?- between(1,3,_), time(test), fail; true.
> % 9,368,753 inferences, 0.266 CPU in 0.291 seconds
> % 9,368,775 inferences, 0.266 CPU in 0.275 seconds
> % 9,369,755 inferences, 0.281 CPU in 0.279 seconds
> true.
> 
> /* Trealla Prolog 3.14.17 */
> ?- between(1,3,_), time(test), fail; true.
> % CPU elapsed 0.203s, 4_052_402 inferences, 19.950 MLips
> % CPU elapsed 0.188s, 4_052_402 inferences, 21.613 MLips
> % CPU elapsed 0.188s, 4_052_402 inferences, 21.613 MLips
>     true.
> 
> Is it different library(rbtrees) ?
> 
> Bye
> 
> /***************************************************************/
> /* Backtracking Test                                           */
> /***************************************************************/
> 
> % test
> test :-
>     between(1, 300, _),
>     rb_empty(T),
>     run_set(300, T, T2),
>     run_remove(600, T2, T3),
>     rb_size(T3, _),
>     fail.
> test.
> 
> % run_set(+Integer, +Tree, -Tree)
> run_set(0, T, T) :- !.
> run_set(N, T, T3) :-
>     random(W),
>     K is floor(W*900),
>     rb_insert(T, K, true, T2),
>     M is N-1,
>     run_set(M, T2, T3).
> 
> % run_remove(+Integer, +Tree, -Tree)
> run_remove(0, T, T) :- !.
> run_remove(N, T, T3) :-
>     random(W),
>     K is floor(W*900),
>     (rb_delete(T, K, T2) -> true; T2 = T),
>     M is N-1,
>     run_remove(M, T2, T3).
> 
> Mild Shock schrieb:
>> Hi,
>>
>> Now that even the last village idiot
>> has groked what Unified Memory is
>> and maybe also what a GPU is.
>>
>> Here a little challenge for the
>> Prolog community, which probably
>> still thinks the AI boom is for
>>
>> probabilistic parots:
>>
>> Winter Challenge 2026:
>> Linked Data on GPU
>>
>> Have Fun!
>>
>> Bye
>>
>> P.S.: Do we need SLG tabling for that?
>> If yes how bring it on GPU? If no
>> what offers the GPU?
>>
>> P.P.S.: What about nevertheless
>> adopting a little probabilistic parots
>> idea? Like heuristic top N
>>
>> linked data queries?
> 
Technical Details
Message-ID: <11ef3u2$m0fo$2@solani.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
References: <11dhk3d$l2e$3@solani.org> <11djod5$24c4$2@solani.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: Mild Shock <janburse@fastmail.fm>
Newsgroups: sci.logic
Subject: Is Picat the new WASM King? (Re: Why has SWI become a slow poke
 Prolog System?)
Date: Sat, 28 Nov 2026 18:44:33 +0100
Message-ID: <11ef3u2$m0fo$2@solani.org>
References: <11dhk3d$l2e$3@solani.org> <11djod5$24c4$2@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 28 Nov 2026 17:44:34 -0000 (UTC)
Injection-Info: solani.org;
	logging-data="721400"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101
 Firefox/140.0 SeaMonkey/2.53.24
Cancel-Lock: sha1:XzXjej+3Rn8naDYO/4nLrij/4yE=
In-Reply-To: <11djod5$24c4$2@solani.org>
X-User-ID: eJwFwYEBwDAEBMCVKniMg+T3H6F3rhBsGBzmdH6SDu0CWl9tWcrl5mF63eXZSYun0/SYjIC8iFB/HKbe/gFJjhXC