The neat thing for me is just not needing to setup a Node environment. You can copy the native binary and it should run as-is.
The big one is not having node as a dependency. Performance, extensibility, safety, yeah, don't really warrant a rewrite.
Also, ideally your lightweight client logic can run on a small device/server with bounded memory usage. If OpenAI spins up a server for each codex query, the size of that server matters (at scale/cost) so shaving off mb of overhead is worthwhile.
There shouldn't be a reason why you couldn't and it would give you performance and zero dependency install.
Astral folks are taking notes. (I wouldn't be surprised if they already have a super secret branch where they rewrite Python and make it 100x faster, but without AI bullshit like Mojo).
Edit: ah, I see, I read “LLM” instead of LLVM at first! It's only after I posted my question that realized my mistake.
I'm not sure it makes sense to compile JavaScript natively, due to the very dynamic nature of the language, you'd end up with a very slow implementation (the JIT compilers make assumptions to optimize the code and fall back to the slow baseline when the assumptions are broken, but you can't do that with AoT).
That's a good point, maybe TypeScript would be a better candidate.
For what it would take to compile TS to native code, check out AssemblyScript.