diff --git a/benchmark/pom.xml b/benchmark/pom.xml
index ec45e48..d5d9f6a 100644
--- a/benchmark/pom.xml
+++ b/benchmark/pom.xml
@@ -35,7 +35,7 @@
org.springframework.boot
spring-boot-dependencies
- 2.2.0.M5
+ 2.2.0.BUILD-SNAPSHOT
pom
import
@@ -49,7 +49,13 @@
com.github.mp911de.microbenchmark-runner
microbenchmark-runner-junit4
- 0.1.0.RELEASE
+ 0.2.0.RELEASE
+
+
+
+ com.github.mp911de.microbenchmark-runner
+ microbenchmark-runner-extras
+ 0.2.0.RELEASE
diff --git a/benchmark/relational/pom.xml b/benchmark/relational/pom.xml
index 8d08166..5866013 100644
--- a/benchmark/relational/pom.xml
+++ b/benchmark/relational/pom.xml
@@ -13,7 +13,7 @@
spring-data-benchmark-relational
Spring Data Benchmarks - Relational Microbenchmarks
-
+
0.1.0.BUILD-SNAPSHOT
@@ -34,44 +34,44 @@
org.springframework.boot
spring-boot-starter-data-jdbc
-
+
com.h2database
h2
-
+
org.postgresql
postgresql
-
+
-
+
org.springframework.boot.experimental
spring-boot-starter-data-r2dbc
${spring-boot-data-r2dbc.version}
-
+
io.r2dbc
r2dbc-h2
- 0.8.0.M8
+ 0.8.0.RC1
-
+
io.r2dbc
r2dbc-postgresql
- 0.8.0.M8
+ 0.8.0.RC1
-
+
-
+
org.mockito
mockito-core
-
+
com.mockrunner
mockrunner-jdbc
diff --git a/benchmark/relational/src/main/java/org/springframework/data/microbenchmark/r2dbc/R2dbcBenchmark.java b/benchmark/relational/src/main/java/org/springframework/data/microbenchmark/r2dbc/R2dbcBenchmark.java
index 1ea478b..51d3270 100644
--- a/benchmark/relational/src/main/java/org/springframework/data/microbenchmark/r2dbc/R2dbcBenchmark.java
+++ b/benchmark/relational/src/main/java/org/springframework/data/microbenchmark/r2dbc/R2dbcBenchmark.java
@@ -15,62 +15,62 @@
*/
package org.springframework.data.microbenchmark.r2dbc;
+import io.r2dbc.spi.Row;
+
import java.util.function.Function;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.infra.Blackhole;
+
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.data.microbenchmark.common.AbstractMicrobenchmark;
import org.springframework.data.r2dbc.core.DatabaseClient;
-import io.r2dbc.spi.Row;
-
/**
* Benchmark for R2DBC and Spring Data R2DBC
- *
+ *
* @author Oliver Drotbohm
*/
public class R2dbcBenchmark extends AbstractMicrobenchmark {
-
+
private static final String FIND_ALL_SQL = "SELECT id, title, pages FROM Book";
private static final String BY_TITLE_SQL = FIND_ALL_SQL + " where title = :title";
- @Param({ /* "postgres", */ "h2-in-memory" /*, "h2" */ })
- String profile;
-
+ @Param({ /* "postgres", */ "h2-in-memory" /*, "h2" */ }) String profile;
+
private DatabaseClient operations;
private Function mapper;
-
+
private R2dbcBookRepository repository;
@Setup
public void setUp() {
R2dbcFixture fixture = new R2dbcFixture(profile);
-
+
ConfigurableApplicationContext context = fixture.getContext();
-
+
this.operations = context.getBean(DatabaseClient.class);
- this.mapper = row -> new Book(row.get("id", Long.class), row.get("title", String.class), row.get("pages", Integer.class));
-
+ this.mapper = row -> new Book(row.get("id", Long.class), row.get("title", String.class),
+ row.get("pages", Integer.class));
+
this.repository = context.getBean(R2dbcBookRepository.class);
}
@Benchmark
public void findByTitle(Blackhole sink) {
-
+
sink.consume(operations.execute(BY_TITLE_SQL) //
.bind("title", "title0") //
- .map(mapper)
- .one() //
+ .map(mapper).one() //
.block());
}
@Benchmark
public void findAll(Blackhole sink) {
-
+
sink.consume(operations.execute(FIND_ALL_SQL) //
.map(mapper) //
.all() //
@@ -82,7 +82,7 @@ public class R2dbcBenchmark extends AbstractMicrobenchmark {
public void repositoryFindByTitle(Blackhole sink) {
sink.consume(repository.findByTitle("title0").block());
}
-
+
@Benchmark
public void repositoryFindTransactionalByTitle(Blackhole sink) {
sink.consume(repository.findTransactionalByTitle("title0").block());
@@ -92,14 +92,4 @@ public class R2dbcBenchmark extends AbstractMicrobenchmark {
public void repositoryFindAll(Blackhole sink) {
sink.consume(repository.findAll().collectList().block());
}
-
- public static void main(String[] args) {
-
- new R2dbcFixture("postgres") //
- .getContext() //
- .getBean(R2dbcBookRepository.class) //
- .findAll() //
- .collectList() //
- .block();
- }
}