Google Closure Compiler Selective Transpilation Performance Evaluation Artifacts

Read full text
Authors: Rishipal Singh Bhatia
Cited by: 1

Abstract

# Google Closure Compiler Selective Transpilation Performance Evaluation Artifacts This package provides the tools and dataset to reproduce the performance evaluation of the "Selective Transpilation" optimization in the Google Closure Compiler (GCC). ## 1. OverviewThe "Script Feature Check" allows the compiler to skip expensive AST traversals for files that do not contain specific modern ES features. This evaluation quantifies the performance benefit across the entire compilation and within the transpilation phase specifically. ## 2. Benchmark Methodology* **Correctness Verification:** The study automatically performs a `diff` between the compiled outputs of both modes to ensure the optimization is "Transparent" (bitwise identical results).* **Total Content:** 100 unique JavaScript files, totaling **~200,000 lines of code**.* **Dataset Split:** * **ES5 Baseline (90%):** 90 files containing 2,000 lines each of pure ES5 code. * **Modern Features (10%):** 10 files containing 2,000 lines of ES5 boilerplate plus one ES6+ feature (e.g., Classes, Arrow Functions).* **Idempotency:** The `generate_test_data.py` script automatically clears the `benchmarks/` directory before execution to ensure a clean, isolated dataset for every run. ## 3. Metrics and Understanding ResultsThe study reports two primary metrics to distinguish between overall throughput and internal efficiency. ### Metric A: Total Compilation Performance (End-to-End)* **Definition:** Measures the total wall-clock time from JVM startup to final output.* **Includes:** JVM startup, File IO, Parsing, Type Checking, Transpiling, and Optimizations.* **Expectation:** You should observe a small but measurable speedup (**~5-8%**). Total time is dominated by non-transpilation tasks. ### Metric B: Transpilation Phase Performance (Isolated)* **Definition:** Sums the internal runtimes of isolated transpilation passes (e.g., `Es6RewriteClass`, `RewritePolyfills`) extracted via the compiler's built-in `PerformanceTracker`.* **Expectation:** You should observe a significant reduction (**~50-60%**). This proves that the "Feature Check" effectively eliminates the CPU cost of unnecessary AST traversals. ## 4. Technical Note: The Tracer MechanismThe isolated phase measurements (Metric B) are captured using the compiler's built-in `--tracer_mode TIMING_ONLY`.* **Measurement:** It records elapsed wall-clock time (real time) using `System.currentTimeMillis()` at the entry and exit of each compiler pass.* **Aggregation:** If a pass is executed multiple times, the tracer reports the aggregate sum.* **Overhead:** While the tracer adds a small constant overhead to each pass, this overhead is identical in both "ON" and "OFF" modes, ensuring the relative efficiency gain remains a valid and accurate signal. ## 5. Reproduction Instructions ### Reproducibility & Stability NoticeThis artifact is verified to be fully functional against the Google Closure Compiler source as of April 2026. Baseline Commit: 6f9771d https://github.com/google/closure-compiler/tree/6f9771de0e9cc7a088d9369db9693bb363971f2b Verified Compatibility: Works with GCC versions from 2023 through April 2026. While the Selective Transpilation logic is intended to be compatible with future versions of the compiler, changes to the Google Closure Compiler (e.g., PhaseOptimizer refactoring) may require minor adjustments to the injection scripts to maintain compatibility with the latest HEAD. ### Option 1: Docker (Recommended)This is the most reliable method as it handles all dependencies, tool architectures (Intel vs. M-series Mac), and environment paths automatically.```bash# 1. Build the isolated environmentdocker build -t gcc-perf-eval . # 2. Run the full measurement suitedocker run gcc-perf-eval``` ### Option 2: Manual Run1. **Prerequisites:** Java 21+, Node.js v20+, Python 3.10+, Git.2. **Download Compiler and Bazelisk:** ```bash git clone https://github.com/google/closure-compiler.git # Use bazelisk-darwin-arm64 if on an M-series Mac curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64 -o bazelisk chmod +x bazelisk ```3. **Run Evaluation:** ```bash python3 generate_test_data.py python3 compare_compiler_performance.py ``` ## 6. Artifact CitationIf you use this artifact in your research, please cite it as:*Rishipal Singh Bhatia. (2026). Google Closure Compiler Selective Transpilation Performance Evaluation Artifacts. Zenodo. https://doi.org/10.5281/zenodo.19659873

Publication details

Journal / source
Zenodo (CERN European Organization for Nuclear Research)
Publication date
20 April 2026