diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d60a41..01f9059 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The public API of this library consists of the public functions declared in file [H3Core.java](./src/main/java/com/uber/h3core/H3Core.java), and support for the Linux x64 and Darwin x64 platforms. +## Unreleased Changes +### Changed +- Restored benchmark target to the build script. (#188) + ## [4.3.2] - 2025-10-10 ### Changed - Added option to build and publish as an Android module into h3-android. (#184) diff --git a/README.md b/README.md index 13b77a3..16e50e6 100644 --- a/README.md +++ b/README.md @@ -90,13 +90,10 @@ Then open the file `build/docs/javadoc/index.html`. ## Benchmarking -To run benchmarks, either execute them from IntelliJ or run the following from shell: (Replace the class name as needed) - -> [!TIP] -> These instructions need to be updated for Gradle. +To run benchmarks, either execute them from IntelliJ or run the following from shell: ```sh -mvn exec:exec -Dexec.executable="java" -Dexec.args="-classpath %classpath com.uber.h3core.benchmarking.H3CoreBenchmark" -Dexec.classpathScope="test" +./gradlew benchmark -Ph3UseDocker=false ``` ## Contributing diff --git a/build.gradle b/build.gradle index e7e6c5f..e7f9c05 100644 --- a/build.gradle +++ b/build.gradle @@ -37,8 +37,8 @@ repositories { } dependencies { - testImplementation 'org.openjdk.jmh:jmh-core:1.19' - testAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.19' + testImplementation 'org.openjdk.jmh:jmh-core:1.37' + testAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.37' testImplementation 'com.google.guava:guava:33.3.1-jre' testImplementation 'org.junit.jupiter:junit-jupiter:5.11.2' testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.2' @@ -101,6 +101,26 @@ processResources { dependsOn buildH3 } +def benchmarkClasses = [ + 'benchmarkH3Core': 'H3CoreBenchmark', + 'benchmarkGridDisk': 'GridDiskBenchmark', + 'benchmarkH3ParentChild': 'H3ParentChildBenchmark', + 'benchmarkCellsToMultipolygon': 'CellsToMultiPolygonBenchmark', + 'benchmarkPolygonToCells': 'PolygonToCellsBenchmark' +] + +benchmarkClasses.each { taskName, className -> + tasks.register(taskName, JavaExec) { + dependsOn processResources + mainClass = "com.uber.h3core.benchmarking.${className}" + classpath = sourceSets.test.runtimeClasspath + } +} + +task benchmark { + dependsOn benchmarkClasses.keySet() +} + test { dependsOn processResources // finalizedBy jacocoTestReport