Running with
node --no-liftoff
avoids this problem.
(This is not an issue on the Web, where code must return to the event loop anyhow, allowing tiering up to work, and node is optimized for that kind of workflow.)
Personally low my 50% speed vs native does not sound like the worst to me. I've spent years using perl, java (in v4-v7 days), node... These have various ways they are less good than native, and we collectively seem to accept that. Ideally yes wasm gets faster but a 2x is pretty ok!
libsodium is very numeric operation heavy IIRC
Edit: ah, higher numbers are better. But that fact is hidden way down in a block of text behind a collapsed details view.
Shameless self promotion here but I’m currently using wasm2go to build a native Go runtime for MicroPython https://github.com/gregfurman/micropython-go
Added you to my users page a couple days ago, hope you don't mind: https://github.com/ncruces/wasm2go/blob/main/USERS.md
(My) NumKong [1] has implementations targeting both vanilla AVX2/Haswell and AVX2-VNNI/Alder Lake, which makes it easy to see where runtimes and code generators leave performance on the table.
I started a few Wasmtime/Cranelift PRs around this, but didn’t manage to finish them :facepalm: Might be a fun weekend project for someone interested in backend/codegen work.
wasmtime-mte could be added to the benchmark.
You would still have slower than native execution speed, security problems with Spectre attacks (in HW process isolation it's avoided by not having other memory mapped at all, other mitigations exist but they cost a lot of performance).
Syscall speedups affect only specific programs or stupidly written SW like some games that are checking current time many many times per frame.
Whether that's still a good idea given Spectre is another question.