WASM updates

I have pushed several updates that affect the WASM version. It notably streamlines the build process and fixes some issues. Summary

  • Support latest version of Emscripten (3.1.37). For building or running on node this needs a fairly recent version of Node.js. v18.16 works.
  • Added -s STACK_SIZE=1048576 -s STACK_OVERFLOW_CHECK=1. The default stack is just 64k without checking. That was the reason behind several crashes.
  • As from now, we by default build using -DVMI_FUNCTIONS=ON when using Clang. This was significantly slower with old versions of Emscripten, but now using functions rather than a switch is over 10% faster. This also holds for clang-15 on x64. clang-14 on arm64 (Apple M1) shows no measurable difference.

With the latest Emscripten and the fixed stack sizes all tests pass! Test may be executed normally using

 ctest [-j 16]

Despite the often claimed (near) native performance, SWI-Prolog on WASM is currently about 7 times slower than native. Vs. native clang this is about 5 times :frowning:

I assume @jeswr will take care of these for the next npm release :slight_smile: