# WASM updates

**URL:** https://swi-prolog.discourse.group/t/wasm-updates/6516
**Category:** Announce
**Created:** [May 3, 2023, 1:21pm UTC](https://swi-prolog.discourse.group/t/wasm-updates/6516 "2023-05-03T13:21:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)
#### Post date: [May 3, 2023, 1:21pm UTC](https://swi-prolog.discourse.group/t/wasm-updates/6516/1 "2023-05-03T13:21:55Z")

</div>

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 ☹

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