In iocaine, every request is served by a script, and there can be any number of them in flight at the same time. I do not control the threads, and I do not want to. Anything thread bound is a no-go.
Any scripting language I'd even consider embedding needs to separate runtime from environment/context/whatever it ends up calling that thing, and must be able to run any number of scripts concurrently, in isolation.
I pretty much need the engine to be Send
+ Sync
, really.
Interpreters are out aswell, they're never going to match the speed of a compiled language (Roto & wasmtime are compiled to machine code via cranelift
).
There are fast-ish languages, like Lua, but my experiments indicate that for iocaine's use-case, neither LuaJIT nor LuaU provide any gains (they usually measured below Lua 5.4!) - my scripts are short, and don't live long, JIT doesn't help much there, as far as I can tell.
I'm willing to add new languages to iocaine, if they match or exceed the speed of Lua, but that's already stretching it. The only reason I have Lua support in iocaine is because of #Fennel. I desperately wanted a lisp. Even if I won't be using it myself, I wanted iocaine to support one. Lua, and thus Fennel, are considerably slower than Roto, but they run at an acceptable speed nevertheless.
Most languages I tried were waaay slower than Lua.