Proposal: Support for GraalVM Native#3958
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
d651efc to
9de8c8e
Compare
This changeset proposes support for invocation of Closure Compiler on the command line, via a GraalVM Native Image binary. Using the [`rules_graal`][1] package, there is now a target for the compiler in native binary form. Downstream, projects can load a bzl file to download a binary distribution for their platform, and run Closure in their own projects without needing to build. Included is a small benchmark tool which compares a fresh native vs. JVM copy on your own system. In preliminary tests (in `SIMPLE` mode only, for now), macOS M1 sees about 70% faster compile time versus execution through a JVM. [1]: https://github.com/andyscott/rules_graal
|
dear google, if there is interest in merging this fork/PR, please let me know and I'm happy to help produce binaries for Windows and x86 macOS, and perhaps crafting some benchmarks for more advanced use of closure. |
|
@sgammon I believe we would really prefer to keep such OSS-specific custom build logic there. Perhaps you would like to see if there are improvements you could make to the way it is building Graal-based binaries? |
|
@brad4d understood, i was not aware of that and will take a look. however, the intent of contributing this here was to provide an easy binary invocation from Bazel-native projects downstream. i'll give this a try through |
This changeset proposes support for invocation of Closure Compiler on the command line, via a GraalVM Native Image binary.
Using the
rules_graalpackage, there is now a target for the compiler in native binary form. Downstream, projects can load a bzl file to download a binary distribution for their platform, and run Closure in their own projects without needing to build the compiler.Included is a small benchmark tool which compares a fresh native vs. JVM copy on your own system. In preliminary tests (in
SIMPLEmode only, for now), macOS M1 sees about 70% faster compile time versus execution through a JVM.Enclosed arch support:
Building and testing
Clone with:
Build with:
Benchmark with:
Impact & Benchmark results
Impact to the Bazel build: about 60s. About 3s if the non-native compiler is built directly. Running a
SIMPLE-mode compilation againstreact,lodash, andjquery, averaged over 50 iterations, is shown below:Test Environment (macOS)
5.1.1Test Environment (Linux)
5.1.1Using the binaries in downstream Bazel projects
In your
WORKSPACE:Then, from inside your project: