I wrote a simple script that measures how many json_encode("Hello World") it can do in 5 seconds and these are the results:
With php test.php
:
Serialized 'Hello World' to JSON 63862450 times in 5 seconds.
With PHP=8.1 npx @php-wasm/cli test.php
:
Serialized 'Hello World' to JSON 30654414 times in 5 seconds.
With the interactive code block
Serialized 'Hello World' to JSON 27264540 times in 5 seconds.
In this oversimplified test, WebAssembly PHP is two times slower than the native build. Not bad at all!