graal
graal copied to clipboard
GraalJS should support Ahead-of-Time(AOT) compilation to Native binary like GraalPy.
GraalPy, which is Python implication of the GraalVM, supports AOT compilation to Native binary.
GraalPy is compiled ahead-of-time to a native executable. This means that you do not need a JVM to run GraalPy and it is compact in size.
In time of now, most of main implications of Python and JavaScript do NOT support AOT compilation.
For example, NodeJS , Deno, and even Bun only supports Just-in-Time(JIT) compilation and they have no plan to support AOT.
However, the case of GraalPy shows us that making Script language to be compiled to Native binary is technically possible. And already there is an AOT compiler for Javascript like ChowJS, but unfortunately it is a closed source, and maybe a project NOT free of charge.
Static Hermes, which is being developed by Meta shows us that AOT compiling of JavaScript could be a killer feature of the project.
It's not quite AOT, but:
- NodeJS supports standalone executables
- Deno supports standalone executables
- Bun supports standalone executables
GraalJs does support AOT, in the sense that you can use GraalJs in a native-image, using Truffle's SVM implementation. We do this with GraalJs, GraalPython, and TruffleRuby, all quite effectively.
Thanks for the feature request, @Foxchandaisuki. I'm guessing you would like to see something similar to GraalPy's standalone application feature for Graal.js? Is that correct?
As @sgammon already pointed out: Graal.js it self can already be AOT-compiled and a js as well as a node distribution of Graal.js is what we release on GitHub, see for example: https://github.com/oracle/graaljs/releases/latest. Graal.js Maven artifacts are published on Maven central.
@fniephaus
I'm guessing you would like to see something similar to GraalPy's standalone application feature for Graal.js? Is that correct?
That's correct.
I hope GraalJS was a something like Kotlin/Native for JavaScript.
GraalPy, which is Python implication of the GraalVM, supports AOT compilation to Native binary.
GraalPy is compiled ahead-of-time to a native executable. This means that you do not need a JVM to run GraalPy and it is compact in size.
In time of now, most of main implications of Python and JavaScript do NOT support AOT compilation.
For example, NodeJS , Deno, and even Bun only supports Just-in-Time(JIT) compilation and they have no plan to support AOT.
However, the case of GraalPy shows us that making Script language to be compiled to Native binary is technically possible. And already there is an AOT compiler for Javascript like ChowJS, but unfortunately it is a closed source, and maybe a project NOT free of charge.
Static Hermes, which is being developed by Meta shows us that AOT compiling of JavaScript could be a killer feature of the project.
IIUC, it's not the user's Python code that is AOT compiled, but the GraalPy runtime itself. GraalPy containts lots of Java code and that Java code is AOT compiled, so then you don't need JVM to run that Java code. Same thing goes for GraalJS
@tarsa The user's Python code can be compiled as well. You would just have to make sure it is loaded and executed within the addressable context managed by native-image; often, Python/Ruby/JS is built into the binary to run arbitrary programs.
But that doesn't stop you from using Auxiliary Images, or from running a Truffle computation of some kind (regardless of language) at build time.
There is also GraalPy's Standalone Applications feature, as pointed out by @fniephaus