-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Put this on maven central so that openjdk users can use graal.js #17
Comments
Hi Mark, we are a bit careful with that approach. Yes, it does work - but we do not recommend it, as performance is far off of what you get when running on GraalVM itself. This problem might be resolved in future versions of JVM; we are working with the Oracle JVM team so that future JVM versions will have the relevant support built-in already, and you just need the respective .jar file of the language you want to use. We'll discuss internally how to better distribute until then. |
Just to add another data point here, there are definitely users out there who don't care that much about performance or AOT and would just like access to all the convenient interop stuff on a stock JVM. (Also I've been struggling to find information about what the differences actually are between GraalVM and the JVM. Graal can be used as the JIT compiler on a normal JVM via JVMCI, right? I'm confused as to what else is involved that means the performance is still "far off" from the GraalVM, is there any documentation which goes over this?) |
The version of Graal in the stock JDK does not (currently) include Truffle partial evaluation. For example:
|
Ah I understand, thanks. |
+1 for this functionality 💯 |
Are there any metrics available on performance without GraalVM? Is it better/same/worse than Nashorn is probably the key one... |
@jonnermut without Graal (Graal, the Java JIT compiler), there is no special optimization of the Graal JavaScript interpreter. No partial evaluation (as with Graal), no bytecode generation (as with Nashorn). Performance characteristics are those of an interpreter than, definitly worse on peak performance. On JDK11+ it will be possible to execute Graal.js with Graal as JIT compiler by setting a few JVM flags. Performance will then be identical to using our custom-built GraalVM. |
Thanks for the explanation @wirthi |
+1 for tregex, graaljs and graaljs-scriptengine |
@wirthi what are the JVM flags to set?. |
I'm with @eliasvasylenko - I'm interested in running JavaScript on a JVM, regardless of performance. Is it just a matter of getting the two missing jars (which aren't published to Maven Central?) and adding them to the classpath? |
In case it helps anyone else, here's what I did that got me off the ground:
I don't know if that's complete, but it's sufficient to run a trivial JavaScript on a JVM from a Java program, with performance caveats per above. |
We plan to publish all the necessary artifacts for running on JDK 11 (with additional JVM flags) to Maven Central in the near future. Stay tuned. |
Hi Andreas, I wonder is there any updates on publishing? Is there some ETA when this is going to be done? Thank you very much! |
@zzFluke the artifacts are already in maven central, the rc8 release notes have instructions on how to use them: https://www.graalvm.org/docs/release-notes/#10-rc8 |
Many thanks @rsalvador !!! I'm going to give it a try. |
Edit: See #17 (comment) for official benchmarks, the measurements below were done on an old laptop running other software just to get a general idea, so they are probably not very accurate. For future reference, to set some very rough performance expectations: Running the example project with graal.js version 1.0.0-rc12 on openjdk 11.0.2 with a dated Intel i5-3210M (4) @ 3.100GHz: Without adding command line flags, graal.js is ~5x slower than Nashorn. |
@zimmi, may I wonder which flags did you mean? |
I ran
|
thanks for your investigations. We have just published a blog post to bring more clarity into this and present it more officially. https://medium.com/graalvm/graalvms-javascript-engine-on-jdk11-with-high-performance-3e79f968a819 Thanks, |
I'm trying to create a EDIT: Nevermind, I think I've messed up my Maven dependencies... |
Hi @plata what setup are you using? Do you start from JDK11 as in the blogpost, or are you on one of our GraalVM builds? On GraalVM, I don't see any obvious reason why that should not work (if so, can you please post a minimal example of your code and commands to start). On JDK11 or any other setup where you provide the JARs yourself, the most obvious thing missing could be the jars for Thanks, |
Like I said, I've found my error in the meantime (I had added the dependencies to |
What are the Maven artifacts that need to be included for GraalVM JDK17? I do not see anything in the docs. I tried including the same jars we did for JDK11, and I'm getting the following exception at runtime:
It would be really helpful if an example Maven project like https://github.com/graalvm/graal-js-jdk11-maven-demo was included for JDK17 and JDK21 as well. |
It looks like the reason for ICU4J being missing is that I installed the js language pack manually using
The reason I did this was because |
@ispringer It seems you're using an older version of GraalVM. There's no Ideally, you should be able to pull in JS into your Maven project using: <dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>polyglot</artifactId>
<version>23.1.2</version>
</dependency>
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>js</artifactId> <!-- or js-community -->
<version>23.1.2</version>
<type>pom</type>
</dependency> and run it on a recent GraalVM for JDK 21. |
Right now, maven central has 2 of 4 jars needed to run graal.js on non-graalvm jdks. Graal-sdk, and truffle api. Tregex and graal.js.jar should me published to maven central as well so people can start testing running the polyglot engine and graal.js on non-graal vm jdks. I've tested this setup works by ripping the graal.js and tregex from a graalvm ce 1.0.0-rc2 release and putting them on the classpath with the graal-sdk and truffle api jars.
The text was updated successfully, but these errors were encountered: