Skip to content

Commit 5e675aa

Browse files
Add Heavy Load Benchmark for ByteCodeTranslator (#4300)
* Add Heavy Load Benchmark for ByteCodeTranslator - Added `HeavyLoadBenchmarkTest` in `vm/tests` which runs ByteCodeTranslator against `JavaAPI`. - Implemented `SimpleProfiler` to capture hotspots during translation. - Updated `vm/tests/pom.xml` to include `JavaAPI` dependency and exclude benchmark from default execution. - Updated `.github/workflows/parparvm-tests.yml` to run the benchmark. - Updated `.github/scripts/generate-quality-report.py` to include benchmark results in the PR comment. * Add Heavy Load Benchmark for ByteCodeTranslator - Added `HeavyLoadBenchmarkTest` in `vm/tests` which runs ByteCodeTranslator against `JavaAPI`. - Implemented `SimpleProfiler` to capture hotspots during translation. - Updated `vm/tests/pom.xml` to exclude benchmark from default execution. - Updated `.github/workflows/parparvm-tests.yml` to run the benchmark and ensure JavaAPI is built. - Updated `.github/scripts/generate-quality-report.py` to include benchmark results in the PR comment. * Add Heavy Load Benchmark for ByteCodeTranslator - Added `HeavyLoadBenchmarkTest` in `vm/tests` which runs ByteCodeTranslator against `JavaAPI`. - Implemented `SimpleProfiler` to capture hotspots during translation. - Updated `vm/tests/pom.xml` to exclude benchmark from default execution. - Updated `.github/workflows/parparvm-tests.yml` to run the benchmark and ensure JavaAPI is built. - Updated `.github/scripts/generate-quality-report.py` to include benchmark results in the PR comment. * Add Heavy Load Benchmark for ByteCodeTranslator - Added `HeavyLoadBenchmarkTest` in `vm/tests` which runs ByteCodeTranslator against `JavaAPI`. - Implemented `SimpleProfiler` to capture hotspots during translation. - Updated `.github/workflows/parparvm-tests.yml` to run the benchmark and ensure JavaAPI is built, and exclude benchmark from standard tests. - Updated `.github/scripts/generate-quality-report.py` to include benchmark results in the PR comment. * Add Heavy Load Benchmark for ByteCodeTranslator - Added `HeavyLoadBenchmarkTest` in `vm/tests` which runs ByteCodeTranslator against `JavaAPI`. - Implemented `SimpleProfiler` to capture hotspots during translation. - Updated `.github/workflows/parparvm-tests.yml` to run the benchmark and ensure JavaAPI is built, exclude benchmark from standard tests, and build dependencies for benchmark. - Updated `.github/scripts/generate-quality-report.py` to include benchmark results in the PR comment. * Refine Heavy Load Benchmark to scan and reference all public JavaAPI classes - Updated `HeavyLoadBenchmarkTest` to scan `JavaAPI.jar` using ASM. - Generate `BenchmarkMain` referencing all detected public classes via `Class.forName`. - Use `@TempDir` for cleanup. - This increases the translation load significantly compared to a simple Hello World. * Add Heavy Load Benchmark for ByteCodeTranslator using Core - Added `HeavyLoadBenchmarkTest` which translates `JavaAPI` and `CodenameOne Core` to simulate heavy load. - Updated `.github/workflows/parparvm-tests.yml` to build `CodenameOne Core` before running benchmark. - Refined test to scan jars using ASM and reference public classes via `Class.forName`. - This provides a realistic stress test for the translator. * Add Heavy Load Benchmark using HelloCodenameOne and IOSPort - Updated `HeavyLoadBenchmarkTest` to scan IOSPort, NativeIOS, and HelloCodenameOne jars if available. - Updated CI workflow to build the full CodenameOne project and HelloCodenameOne sample app to provide these artifacts. - Unzips nativeios.jar from the IOS bundle to simulate native source inclusion. - This creates a realistic translation workload. * Add Heavy Load Benchmark with Full Application Load - Updated `HeavyLoadBenchmarkTest` to scan IOSPort, NativeIOS, and HelloCodenameOne jars if available. - Updated CI workflow to build the full CodenameOne project and HelloCodenameOne sample app to provide these artifacts. - Unzips nativeios.jar from the IOS bundle to simulate native source inclusion. - Compiles HelloCodenameOne sources locally within the test to ensure availability. - This creates a realistic translation workload. * Add Heavy Load Benchmark using Maven Central Artifacts - Updated `HeavyLoadBenchmarkTest` to use `codenameone-core` and `codenameone-ios` artifacts downloaded via `maven-dependency-plugin`. - Updated `vm/tests/pom.xml` to include dependencies and copy them to `target/benchmark-dependencies`. - Removed complex build steps from CI workflow. - Test compiles HelloCodenameOne source against downloaded artifacts. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent a59f028 commit 5e675aa

File tree

4 files changed

+475
-1
lines changed

4 files changed

+475
-1
lines changed

.github/scripts/generate-quality-report.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,14 @@ def parse_checkstyle() -> Optional[AnalysisReport]:
441441
return AnalysisReport(totals=severities, findings=findings)
442442

443443

444+
def parse_benchmark() -> Optional[str]:
445+
for target_dir in TARGET_DIRS:
446+
candidate = target_dir / "benchmark-results.md"
447+
if candidate.exists():
448+
return candidate.read_text(encoding="utf-8")
449+
return None
450+
451+
444452
def format_tests(totals: Optional[Dict[str, int]]) -> str:
445453
if not totals:
446454
return "- ⚠️ No test results were found."
@@ -650,6 +658,7 @@ def build_report(
650658
spotbugs, spotbugs_generated, spotbugs_error = parse_spotbugs()
651659
pmd = parse_pmd()
652660
checkstyle = parse_checkstyle()
661+
benchmark_report = parse_benchmark()
653662

654663
write_analysis_html("spotbugs", "SpotBugs Findings", spotbugs)
655664
write_analysis_html("pmd", "PMD Findings", pmd)
@@ -672,6 +681,9 @@ def build_report(
672681
"### Test & Coverage",
673682
format_tests(tests),
674683
]
684+
if benchmark_report:
685+
lines.append("")
686+
lines.append(benchmark_report)
675687
lines.extend(
676688
format_coverage(
677689
coverage,

.github/workflows/parparvm-tests.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,17 @@ jobs:
7878

7979
- name: Run ParparVM JVM tests
8080
working-directory: vm
81-
run: mvn -B clean test -pl tests -am
81+
run: mvn -B clean package -pl JavaAPI -am -DskipTests && mvn -B test -pl tests -am -DexcludedGroups=benchmark
82+
env:
83+
JDK_8_HOME: ${{ env.JDK_8_HOME }}
84+
JDK_11_HOME: ${{ env.JDK_11_HOME }}
85+
JDK_17_HOME: ${{ env.JDK_17_HOME }}
86+
JDK_21_HOME: ${{ env.JDK_21_HOME }}
87+
JDK_25_HOME: ${{ env.JDK_25_HOME }}
88+
89+
- name: Run ParparVM Benchmark
90+
working-directory: vm
91+
run: mvn -B test -pl tests -am -Dgroups=benchmark -Djacoco.skip=true
8292
env:
8393
JDK_8_HOME: ${{ env.JDK_8_HOME }}
8494
JDK_11_HOME: ${{ env.JDK_11_HOME }}

vm/tests/pom.xml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,47 @@
3131
<artifactId>junit-jupiter</artifactId>
3232
<scope>test</scope>
3333
</dependency>
34+
<dependency>
35+
<groupId>com.codenameone</groupId>
36+
<artifactId>codenameone-core</artifactId>
37+
<version>7.0.150</version>
38+
<scope>test</scope>
39+
</dependency>
40+
<dependency>
41+
<groupId>com.codenameone</groupId>
42+
<artifactId>codenameone-ios</artifactId>
43+
<version>7.0.150</version>
44+
<scope>test</scope>
45+
</dependency>
46+
<dependency>
47+
<groupId>com.codenameone</groupId>
48+
<artifactId>codenameone-ios</artifactId>
49+
<version>7.0.150</version>
50+
<classifier>bundle</classifier>
51+
<scope>test</scope>
52+
</dependency>
3453
</dependencies>
3554

3655
<build>
3756
<plugins>
57+
<plugin>
58+
<artifactId>maven-dependency-plugin</artifactId>
59+
<version>3.6.1</version>
60+
<executions>
61+
<execution>
62+
<id>copy-dependencies</id>
63+
<phase>generate-test-resources</phase>
64+
<goals>
65+
<goal>copy-dependencies</goal>
66+
</goals>
67+
<configuration>
68+
<outputDirectory>${project.build.directory}/benchmark-dependencies</outputDirectory>
69+
<includeGroupIds>com.codenameone</includeGroupIds>
70+
<includeScope>test</includeScope>
71+
</configuration>
72+
</execution>
73+
</executions>
74+
</plugin>
3875
<plugin>
3976
<groupId>org.apache.maven.plugins</groupId>
4077
<artifactId>maven-compiler-plugin</artifactId>

0 commit comments

Comments
 (0)