[#1170] Improve performance on jOOQ's reflection usage - Added benchmark

This commit is contained in:
Lukas Eder 2013-02-01 18:56:50 +01:00
parent da43b21fa8
commit c4850ad5e1
2 changed files with 16 additions and 0 deletions

View File

@ -45,6 +45,7 @@ import org.jooq.Record1;
import org.jooq.Record2;
import org.jooq.Record3;
import org.jooq.Record6;
import org.jooq.Result;
import org.jooq.Select;
import org.jooq.TableRecord;
import org.jooq.UpdatableRecord;
@ -77,6 +78,7 @@ public class BenchmarkTests<
T785 extends TableRecord<T785>>
extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T725, T639, T785> {
private static final int REPETITIONS_RECORD_INTO = 2000;
private static final int REPETITIONS_FIELD_ACCESS = 1000000;
private static final int REPETITIONS_SELECT = 100;
private static final String RANDOM = "" + new Random().nextLong();
@ -85,6 +87,15 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
super(delegate);
}
@Test
public void testBenchmarkRecordInto() throws Exception {
Result<B> books = create().fetch(TBook());
for (int i = 0; i < REPETITIONS_RECORD_INTO; i++) {
books.into(TBook().getRecordType());
}
}
@Test
public void testBenchmarkFieldAccess() throws Exception {
// This benchmark is inspired by a private contribution by Roberto Giacco

View File

@ -1974,6 +1974,11 @@ public abstract class jOOQAbstractTest<
new LoaderTests(this).testLoader();
}
@Test
public void testBenchmarkRecordInto() throws Exception {
new BenchmarkTests(this).testBenchmarkRecordInto();
}
@Test
public void testBenchmarkFieldAccess() throws Exception {
new BenchmarkTests(this).testBenchmarkFieldAccess();