1,688 karma · joined June 6, 2017
I live on the coast of Norway so I am trying to keep up with the research. It is exactly as the article says: Even if there's "only" a 10% chance, or even 5%, that's a huge risk to take to stay. So I think it's important to pay attention to this henceforward.
... but I don't know if I would lump bytecode with JIT. Bytecodes don't need or use RWX execute segments, for example. Lots of your favorite JITs do, for speed.
So now it's a race. For example, wasmtime needs 48ns just to enter and leave, and 24ns to make a call into the host. That's around 100-150 instructions libriscv can execute before wasmtime has even overcome the fixed call latencies. And then add 50 each time we make a call back into the engine.
Now combine this with my ~200 host functions in my game, and I don't know how many in-game events. Which function would wasmtime be faster at? I don't know, probably not a single one. And that's really it. There's no fibonacci computations in game engine scripting. It's just logic.
As far as using complex run-times for scripting: I've already been doing this dance for years now. For example, TinyKVM is a native performance KVM userspace emulator that I among other things ran v8 inside. You can find my research paper about it. So it's not like I couldn't throw v8 in there and slideware some JS solution. But, I really do prefer writing C++.
Also related is attack surface. libriscv is 10k LOC. wasmtime is what, 350k LOC?
Here is a random function I benchmarked: https://fwsgonzo.medium.com/a-sandboxed-rainbow-function-b42...
wasmtime spent 107ns and libriscv 57ns. Those kinds of functions is your average script function. And, even if we were exactly matching in latency, I would still call that a win!
EDIT: To add, you did make a good point about tooling, components etc.
I have a lot of blog posts that you can read to get up to speed. Or maybe you already made up your mind.
I used my usual benchmarks: STREAM (memory) and CoreMark (CPU).
I don't know. Perhaps clang-cl could be used on Windows? It depends on how much of a run-time environment one wants.
It's also about understand the black box that is your program by using tools beside the programming language to understand memory usage, allocation patterns, blocking operations and dead-time, bloat, destructive interference in multiprocessing applications, NUMA-stuff and so on, and so forth. Then there's program-specific things like SIMD-processing, using efficient algorithms, differences created between standard-library implementations.
So, which language is faster is just a chapter in a book about performance. And, comparing two languages it feels like comparing apples to oranges. If you had the chance to go back and write a program over again, you will probably end up with an overall different, hopefully better, design.