graalvm / graal-js-jdk11-maven-demo

An example project how to run Graal/JavaScript on JDK 11 with Graal as optimizing JIT compiler for best performance.
Universal Permissive License v1.0
177 stars 63 forks source link

Run the benchmarks in the unit test #4

Closed JaroslavTulach closed 6 years ago

JaroslavTulach commented 6 years ago

I'd like to make sure that the unit tests are executed at "Graal-speed". First step is to measure how fast the engines are. Next step is to configure the plugin to use the Graal compiler.

boris-spas commented 6 years ago

Good luck! I've tried to make that happen but have unfortunately failed.

JaroslavTulach commented 6 years ago

It needed a lot of debugging of the Maven surefire plugin. There is special handling for module-info in main source directory. Alas, I don't see special handling of module-info in test sources. As such I had to add truffle-api into compile scope. That isn't ideal, but it works.

chumer commented 6 years ago

Its not ideal that we need to put it on compile. Is that a bug of Maven surefire that it does not respect transitive dependencies? Because js refers to truffle already?

JaroslavTulach commented 6 years ago

So far I managed to convince surefire to run in "module mode" for the main project sources and "classpath mode" for the tests. In this setup the truffle-api module has to be shared between the compiler and the JavaScript engine. Using compile scope does the trick. So far other attempts failed.

JaroslavTulach commented 6 years ago

At the end it was not that complex. No need to play with module-info.java at all. Just download SDK, Truffle API and compiler into a subdirectory and enable them as modules.

boris-spas commented 6 years ago

Very cool! Thanks a lot!