Julia and WASM

Worth mentioning the proprietary AOT compiler SyslabCC, which answers the question of possibility and helps explains some of the limitations that trimmed executables must have. The type stability requirement in particular is important for limiting executable size; 11:11 of the talk introducing the development of juliac explains that dynamic dispatches with few enough options could be feasible, but otherwise supporting too many runtime branches requires too much AOT-compilation. In fact, JIT compilation is usually more efficient by compiling anything that is called in a session, not everything that could be. An AOT compiler can support dynamic features like JIT compilation, but it also needs the memory and runtime overheads, as PackageCompiler.jl and JuliaScript.jl demonstrate.

AOT-only compilation is not a desirable setting for a REPL or any interactive shell. Any new code you write can’t be compiled interactively and at best gets interpreted a la default Debugger.jl, which is slow. Interactive work requires metadata like module namespaces and method tables, which you would want to trim out for minimal executables; 9:36 of the juliac talk explains limitations that comes with trimming. An AOT-only REPL would have less overhead, but it’s still too much for the small executable crowd, and everyone else has better options. We already AOT-compile code per package, which unlike other AOT compilation approaches mentioned so far has the necessary conditions to import them interactively in a REPL.

5 Likes