From c4850ad5e1d60bab7d102effe8ad5358c0e474bc Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 1 Feb 2013 18:56:50 +0100 Subject: [PATCH] [#1170] Improve performance on jOOQ's reflection usage - Added benchmark --- .../src/org/jooq/test/_/testcases/BenchmarkTests.java | 11 +++++++++++ jOOQ-test/src/org/jooq/test/jOOQAbstractTest.java | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/jOOQ-test/src/org/jooq/test/_/testcases/BenchmarkTests.java b/jOOQ-test/src/org/jooq/test/_/testcases/BenchmarkTests.java index 4b840b9e42..d045b45007 100644 --- a/jOOQ-test/src/org/jooq/test/_/testcases/BenchmarkTests.java +++ b/jOOQ-test/src/org/jooq/test/_/testcases/BenchmarkTests.java @@ -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> extends BaseTest { + 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 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 diff --git a/jOOQ-test/src/org/jooq/test/jOOQAbstractTest.java b/jOOQ-test/src/org/jooq/test/jOOQAbstractTest.java index 3ad00da762..4704073675 100644 --- a/jOOQ-test/src/org/jooq/test/jOOQAbstractTest.java +++ b/jOOQ-test/src/org/jooq/test/jOOQAbstractTest.java @@ -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();