Hi,
I made a test, you can run it from here, its CORS enabled:
:- ['
https://www.dogelog.ch/module/bench/suite.pl'].
:- suite.
First a WASM Prolog, showing warm run:
nrev % 2,995,946 inferences, 1.417 CPU in 1.417 seconds
crypt % 4,169,360 inferences, 2.776 CPU in 2.776 seconds
deriv % 2,100,600 inferences, 1.555 CPU in 1.555 seconds
poly % 2,088,942 inferences, 1.681 CPU in 1.681 seconds
sortq % 3,627,136 inferences, 1.923 CPU in 1.923 seconds
tictac % 1,013,322 inferences, 2.659 CPU in 2.659 seconds
queens % 4,599,283 inferences, 2.496 CPU in 2.496 seconds
query % 8,645,933 inferences, 5.189 CPU in 5.189 seconds
mtak % 3,946,569 inferences, 1.642 CPU in 1.642 seconds
perfect % 3,243,474 inferences, 1.498 CPU in 1.498 seconds
calc % 3,062,293 inferences, 1.791 CPU in 1.791 seconds
https://wasm.swi-prolog.org/wasm/tinkerThen a JavaScript Prolog, showing warm run:
nrev % Zeit 1413 ms, GC 0 ms, Lips 2127790, Uhr 04.03.2025 10:00
crypt % Zeit 1204 ms, GC 0 ms, Lips 3461555, Uhr 04.03.2025 10:00
deriv % Zeit 1270 ms, GC 0 ms, Lips 3094644, Uhr 04.03.2025 10:00
poly % Zeit 1068 ms, GC 0 ms, Lips 2336682, Uhr 04.03.2025 10:00
sortq % Zeit 1595 ms, GC 0 ms, Lips 2667571, Uhr 04.03.2025 10:00
tictac % Zeit 1596 ms, GC 0 ms, Lips 1087015, Uhr 04.03.2025 10:00
queens % Zeit 1718 ms, GC 0 ms, Lips 3322441, Uhr 04.03.2025 10:00
query % Zeit 2764 ms, GC 0 ms, Lips 3132399, Uhr 04.03.2025 10:00
mtak % Zeit 2129 ms, GC 8 ms, Lips 3936434, Uhr 04.03.2025 10:00
perfect % Zeit 1415 ms, GC 0 ms, Lips 3317768, Uhr 04.03.2025 10:00
calc % Zeit 1314 ms, GC 0 ms, Lips 2922571, Uhr 04.03.2025 10:00
https://www.xlog.ch/runtab/doclet/docs/04_tutor/basic/example01/package.htmlWhats the cause of the discrepancy? 32-bit? Auto-Yield?
Bye
Mild Shock schrieb:
Hi,
I wonder wether WASM will be fast some time.
I found this paper which draws a rather dim picture,
but the paper is already a little bit old:
Understanding the Performance of WebAssembly Application
Weihang Wang et al. - 2021
https://weihang-wang.github.io/papers/imc21.pdf
The take away is more or less that jitted JavaScript has
same speed as WASM. With sometimes WASM more favorable
outcome for Firefox than for Chrome and Edge:
Java Script Chrome Firefox Edge
D.1 Exec. Time (ms) 45.57 48.26 63.62
M.2 Exec. Time (ms) 249.60 167.03 201.68
WASM Chrome Firefox Edge
D.1 Exec. Time (ms) 65.23 39.65 83.53
M.2 Exec. Time (ms) 233.08 345.98 192.87
Bye