OCaml 5.x code using effect handlers can be compiled in three different ways:
--effects=jspi (default) emits code utilizing the JavaScript-Promise Integration extension. It works by default in Chrome 137, Node.js 25, and higher versions. Performing effects is slower than with --effects=cps.
--effects=cps enables the CPS transformation from js_of_ocaml. The generated code is slower, larger, and less readable, but it runs on any supported engine. Use this for other browsers.
--effects=native uses the WebAssembly Stack Switching proposal (typed continuations). It provides the best performance but requires a runtime with support for the WasmFX extension (currently available, behind the --experimental-wasm-wasmfx flag, in Chrome 148 or higher, or in a recent Node.js canary release with V8 version 14.7.100 or higher).
Since the value representation is different, some adaptations are necessary.
The most notable change is that, except for integers, OCaml numbers are no longer mapped to JavaScript numbers. So, explicit conversions Js.to_float and Js.float are now necessary to convert between OCaml floats and JavaScript numbers. The typing of JavaScript Typed Arrays has also been changed to deal with this.