Skip to content
An example project how to run Graal/JavaScript on JDK 11 with Graal as optimizing JIT compiler for best performance.
Branch: master
Clone or download
boris-spas Add Darwin gate.
PullRequest: graal-js-jdk11-maven-demo/4
Latest commit 01f9557 Feb 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src add missing UPL license information Feb 25, 2019
.gitignore Basic gitignore. Oct 30, 2018
.travis.yml RC12 update. Feb 5, 2019
LICENSE
README.md
ci.jsonnet
pom.xml RC10 update. Jan 7, 2019

README.md

Running GraalJS on stock JDK11

This is a simple maven project that demonstrates how it's possible to run GraalJS on a stock JDK11. The application is a simple JavaScript benchmark embedded in a Java application which compares performance of GraalJS and Nashorn.

Pre requirements

Setup

  • Clone this repository
git clone https://github.com/graalvm/graal-js-jdk11-maven-demo
  • Move to the newly cloned directory
cd graal-js-jdk11-maven-demo
  • Make sure that JAVA_HOME is pointed at a JDK11
export JAVA_HOME=/path/to/jdk11
  • Package the project using Maven
mvn package

Execution

This project provides two execution setups (using the exec-maven-plugin). One uses the Graal compiler to JIT compile JavaScript for better performance, and the other does not and only interprets the JavaScript code. Both executions output benchmark results for GraalJS (via the GraalVM Polyglot API and the Java Scripting API) and Nashorn.

To Execute with Graal run

mvn exec:exec

To Execute without Graal run

mvn exec:exec@nograal

The benchmark prints the time per iteration in milliseconds, so lower values are better.

Running on GraalVM

This project is also setup to run on GraalVM. The setup is the same except that your JAVA_HOME should point to a directory contain GraalVM. In this case, execution without Graal is not supported.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.