Skip to content

Commit c5c233b

Browse files
authored
benchmark instructions upgrade for gradle (#188)
* benchmark instructions upgrade for gradle * changelog entry
1 parent c2cacdf commit c5c233b

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ The public API of this library consists of the public functions declared in
55
file [H3Core.java](./src/main/java/com/uber/h3core/H3Core.java), and support
66
for the Linux x64 and Darwin x64 platforms.
77

8+
## Unreleased Changes
9+
### Changed
10+
- Restored benchmark target to the build script. (#188)
11+
812
## [4.3.2] - 2025-10-10
913
### Changed
1014
- Added option to build and publish as an Android module into h3-android. (#184)

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,10 @@ Then open the file `build/docs/javadoc/index.html`.
9090

9191
## Benchmarking
9292

93-
To run benchmarks, either execute them from IntelliJ or run the following from shell: (Replace the class name as needed)
94-
95-
> [!TIP]
96-
> These instructions need to be updated for Gradle.
93+
To run benchmarks, either execute them from IntelliJ or run the following from shell:
9794

9895
```sh
99-
mvn exec:exec -Dexec.executable="java" -Dexec.args="-classpath %classpath com.uber.h3core.benchmarking.H3CoreBenchmark" -Dexec.classpathScope="test"
96+
./gradlew benchmark -Ph3UseDocker=false
10097
```
10198

10299
## Contributing

build.gradle

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ repositories {
3737
}
3838

3939
dependencies {
40-
testImplementation 'org.openjdk.jmh:jmh-core:1.19'
41-
testAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.19'
40+
testImplementation 'org.openjdk.jmh:jmh-core:1.37'
41+
testAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.37'
4242
testImplementation 'com.google.guava:guava:33.3.1-jre'
4343
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.2'
4444
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.2'
@@ -101,6 +101,26 @@ processResources {
101101
dependsOn buildH3
102102
}
103103

104+
def benchmarkClasses = [
105+
'benchmarkH3Core': 'H3CoreBenchmark',
106+
'benchmarkGridDisk': 'GridDiskBenchmark',
107+
'benchmarkH3ParentChild': 'H3ParentChildBenchmark',
108+
'benchmarkCellsToMultipolygon': 'CellsToMultiPolygonBenchmark',
109+
'benchmarkPolygonToCells': 'PolygonToCellsBenchmark'
110+
]
111+
112+
benchmarkClasses.each { taskName, className ->
113+
tasks.register(taskName, JavaExec) {
114+
dependsOn processResources
115+
mainClass = "com.uber.h3core.benchmarking.${className}"
116+
classpath = sourceSets.test.runtimeClasspath
117+
}
118+
}
119+
120+
task benchmark {
121+
dependsOn benchmarkClasses.keySet()
122+
}
123+
104124
test {
105125
dependsOn processResources
106126
// finalizedBy jacocoTestReport

0 commit comments

Comments
 (0)