Permalink
Browse files

perf: add BigDecimal test performance test to ProcessResultSet

  • Loading branch information...
vlsi committed Oct 29, 2015
1 parent ad7fc43 commit 6dc41835603089405201606c45661428fb90a90e
@@ -7,6 +7,7 @@
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.postgresql.benchmark.profilers.FlightRecorderProfiler;
import org.postgresql.util.ConnectionUtil;
import java.sql.*;
@@ -27,11 +28,17 @@
public enum FieldType {
INT,
BIGINT,
BIGDECIMAL,
STRING,
TIMESTAMP,
TIMESTAMPTZ,
}
public enum GetterType {
BEST,
OBJECT
}
@Param({"1", "50", "100"})
private int nrows;
@@ -44,6 +51,9 @@
@Param({"false"})
public boolean unique;
@Param({"BEST"})
public GetterType getter;
private Connection connection;
private String sql;
@@ -66,6 +76,8 @@ public void setUp() throws SQLException {
sb.append("t.x");
} if (type == FieldType.BIGINT) {
sb.append("1234567890123456789");
} if (type == FieldType.BIGDECIMAL) {
sb.append("12345678901234567890123456789");
} else if (type == FieldType.STRING) {
sb.append("'test string'");
} else if (type == FieldType.TIMESTAMP) {
@@ -93,10 +105,14 @@ public Statement bindExecuteFetch(Blackhole b) throws SQLException {
ResultSet rs = ps.executeQuery();
while (rs.next()) {
for (int i = 1; i <= ncols; i++) {
if (type == FieldType.INT) {
if (getter == GetterType.OBJECT) {
b.consume(rs.getObject(i));
} else if (type == FieldType.INT) {
b.consume(rs.getInt(i));
} else if (type == FieldType.BIGINT) {
b.consume(rs.getBigDecimal(i));
} else if (type == FieldType.BIGDECIMAL) {
b.consume(rs.getBigDecimal(i));
} else if (type == FieldType.STRING) {
b.consume(rs.getString(i));
} else if (type == FieldType.TIMESTAMP) {

0 comments on commit 6dc4183

Please sign in to comment.