summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/db/Jamfile.jam35
-rw-r--r--slicer/db/testPerf.cpp24
2 files changed, 59 insertions, 0 deletions
diff --git a/slicer/db/Jamfile.jam b/slicer/db/Jamfile.jam
index 73c05e5..a304b9e 100644
--- a/slicer/db/Jamfile.jam
+++ b/slicer/db/Jamfile.jam
@@ -4,6 +4,7 @@ import ../test/slicer.jam ;
lib dbppcore : : : : <include>/usr/include/dbpp ;
lib dbpp-postgresql : : : : <include>/usr/include/dbpp-postgresql ;
lib stdc++fs ;
+lib benchmark ;
obj sqlExceptions : sqlExceptions.ice : <use>../slicer//slicer <toolset>tidy:<checker>none ;
lib slicer-db :
@@ -137,6 +138,40 @@ run testUpdate.cpp
testUpdate
;
+run
+ [ obj perf : testPerf.cpp :
+ <slicer>pure
+ <use>../test//types
+ <implicit-dependency>../test//types
+ <use>benchmark
+ <use>stdc++fs
+ <use>dbpp-postgresql
+ <use>dbppcore
+ <use>..//adhocutil
+ <use>../test//common
+ <use>../slicer//slicer
+ <implicit-dependency>../slicer//slicer
+ <use>testCommon
+ <implicit-dependency>testCommon
+ <use>slicer-db
+ ]
+ : : :
+ <library>benchmark
+ <library>stdc++fs
+ <library>dbpp-postgresql
+ <library>dbppcore
+ <library>../test//common
+ <library>../test//types
+ <library>../slicer//slicer
+ <implicit-dependency>../slicer//slicer
+ <library>slicer-db
+ <library>..//adhocutil
+ <library>testCommon
+ <implicit-dependency>testCommon
+ <variant>profile:<testing.execute>on
+ <testing.execute>off
+ : testPerf ;
+
alias install : install-lib install-slice ;
explicit install ;
explicit install-lib ;
diff --git a/slicer/db/testPerf.cpp b/slicer/db/testPerf.cpp
new file mode 100644
index 0000000..2f98cd2
--- /dev/null
+++ b/slicer/db/testPerf.cpp
@@ -0,0 +1,24 @@
+#include "sqlSelectDeserializer.h"
+#include "testMockCommon.h"
+#include <benchmark/benchmark.h>
+#include <connection.h>
+#include <definedDirs.h>
+#include <slicer/slicer.h>
+#include <testModels.h>
+
+const StandardMockDatabase db;
+
+class CoreFixture : public benchmark::Fixture, public ConnectionFixture { };
+
+BENCHMARK_F(CoreFixture, bulk_select_complex)(benchmark::State & state)
+{
+ auto sel = db->select(R"SQL(
+ SELECT s mint, CAST(s AS NUMERIC(7,1)) mdouble, CAST(s as text) mstring, s % 2 = 0 mbool
+ FROM GENERATE_SERIES(1, 10000) s)SQL");
+ for (auto _ : state) {
+ benchmark::DoNotOptimize(
+ Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, TestDatabase::BuiltInSeq>(sel.get()));
+ }
+}
+
+BENCHMARK_MAIN();