diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-08-11 22:30:08 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-08-11 22:30:08 +0100 |
commit | c0d2a75e235ce22c2835dd2485e5e15f3602c3cb (patch) | |
tree | 1acd7c6d9db5c274c8a140d78c94bbe22421f4c8 /slicer/db/testPerf.cpp | |
parent | WIP perf tests (diff) | |
download | slicer-c0d2a75e235ce22c2835dd2485e5e15f3602c3cb.tar.bz2 slicer-c0d2a75e235ce22c2835dd2485e5e15f3602c3cb.tar.xz slicer-c0d2a75e235ce22c2835dd2485e5e15f3602c3cb.zip |
Add perf test over DB SQL select complex
Diffstat (limited to 'slicer/db/testPerf.cpp')
-rw-r--r-- | slicer/db/testPerf.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
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(); |