summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-08-21 21:38:03 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-08-21 21:38:03 +0100
commit9128c51c7315375515a104b1bea2cfe8ca966881 (patch)
treed326a92cdea206f5fdd1936685c7c6709b05a962
parentMake remaining non-root ModelParts on the stack (diff)
downloadslicer-9128c51c7315375515a104b1bea2cfe8ca966881.tar.bz2
slicer-9128c51c7315375515a104b1bea2cfe8ca966881.tar.xz
slicer-9128c51c7315375515a104b1bea2cfe8ca966881.zip
Add a DB perf case for a complex with non-optional members
-rw-r--r--slicer/db/testPerf.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/slicer/db/testPerf.cpp b/slicer/db/testPerf.cpp
index 2f98cd2..bb2a4c3 100644
--- a/slicer/db/testPerf.cpp
+++ b/slicer/db/testPerf.cpp
@@ -1,6 +1,7 @@
#include "sqlSelectDeserializer.h"
#include "testMockCommon.h"
#include <benchmark/benchmark.h>
+#include <collections.h>
#include <connection.h>
#include <definedDirs.h>
#include <slicer/slicer.h>
@@ -8,17 +9,29 @@
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(
+class CoreFixture : public benchmark::Fixture, public ConnectionFixture {
+protected:
+ template<typename Out>
+ void
+ do_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()));
+ for (auto _ : state) {
+ benchmark::DoNotOptimize(Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, Out>(sel.get()));
+ }
}
+};
+
+BENCHMARK_F(CoreFixture, bulk_select_complex)(benchmark::State & state)
+{
+ do_bulk_select_complex<TestDatabase::BuiltInSeq>(state);
+}
+
+BENCHMARK_F(CoreFixture, bulk_select_complex_non_optional)(benchmark::State & state)
+{
+ do_bulk_select_complex<TestModule::BuiltInSeq>(state);
}
BENCHMARK_MAIN();