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
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)