This is an automated email from the ASF dual-hosted git repository.
bchapuis pushed a commit to branch 849-benchmarking
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
The following commit(s) were added to refs/heads/849-benchmarking by this push:
new f946c21c Add benchmarks
f946c21c is described below
commit f946c21cecdac74286e9ecbddcb5472d7c957a9f
Author: Bertil Chapuis <[email protected]>
AuthorDate: Wed Jun 12 17:53:06 2024 +0200
Add benchmarks
---
.gitignore | 3 ++
.../baremaps/benchmarking/SmallFileBenchmark.java | 54 ++++++++++++++++++++++
2 files changed, 57 insertions(+)
diff --git a/.gitignore b/.gitignore
index a66d0430..15b5788b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,6 +49,9 @@ examples/openstreetmap/tiles/
examples/transformation/*.pbf
+# Benchmarking
+baremaps-benchmarking/small/
+
# Docs
.jekyll-cache/
_site/
diff --git
a/baremaps-benchmarking/src/main/java/org/apache/baremaps/benchmarking/SmallFileBenchmark.java
b/baremaps-benchmarking/src/main/java/org/apache/baremaps/benchmarking/SmallFileBenchmark.java
new file mode 100644
index 00000000..c1921a5a
--- /dev/null
+++
b/baremaps-benchmarking/src/main/java/org/apache/baremaps/benchmarking/SmallFileBenchmark.java
@@ -0,0 +1,54 @@
+package org.apache.baremaps.benchmarking;
+
+import org.apache.baremaps.geoparquet.GeoParquetReader;
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.concurrent.TimeUnit;
+
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+@State(Scope.Benchmark)
+@Warmup(iterations = 0)
+@Measurement(iterations = 1)
+public class SmallFileBenchmark {
+
+ private Path source =
Path.of("baremaps-testing/data/samples/example.parquet").toAbsolutePath();
+ private Path directory =
Path.of("baremaps-benchmarking/small").toAbsolutePath();
+
+ public static void main(String[] args) throws RunnerException, IOException
{
+// Options opt = new OptionsBuilder()
+// .include(SmallFileBenchmark.class.getSimpleName())
+// .forks(1)
+// .build();
+// new Runner(opt).run();
+ var benchmark = new SmallFileBenchmark();
+ benchmark.setup();
+ benchmark.read();
+ }
+
+ @Setup
+ public void setup() throws IOException {
+ if (!Files.exists(directory)) {
+ for (int i = 0; i < 1000; i++) {
+ Path target = directory.resolve(i + ".parquet");
+ Files.createDirectories(target.getParent());
+ Files.copy(source, target);
+ }
+ }
+ }
+
+ @Benchmark
+ public void read() {
+ GeoParquetReader reader = new GeoParquetReader(directory.toUri());
+ System.out.println(reader.readParallel().count());
+ }
+
+
+}