3 ms·
Right, but that trick also isn't new. emacs was doing it decades ago and there are JVMs that also do it. That's how GraalVM native images can start and run fast
by mike_hearn 3y ago
Right, but that trick also isn't new. emacs was doing it decades ago and there are JVMs that also do it. That's how GraalVM native images can start and run faster than C programs do: the app is initialized at build time and then the state is just mmapped into a pre-compiled native process.
HotSpot has a less aggressive version of this where you can pre-initialize a lot of VM state and dump it to a file for faster startup time. It's about a 30% win and that's going up over time, but it doesn't AOT compile everything.
Of course, if you're serious about instant startup from zero then you end up going the native-image route, but then what value is WASM adding? What's being shipped to the edge in that case is a compiled binary anyway.
There is some scope here for threading the needle - for example, an edge worker implementation could be given compiled bytecode of some kind and then do the compilation and dumping process server side. This is a bit like how Apple compiled LLVM bitcode itself for delivery. However then the build process needs to be sandboxed and at that point why not go full FaaS and let users upload whatever binaries they like? AWS is doing it successfully.