Skip to content

Commit

Permalink
[misc] adding batch benchmark with client rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Sep 20, 2022
1 parent 9980141 commit b9e3f99
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions benchmark/main-benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ BENCHMARK(BM_DO_1000_PARAMS)->Name(TYPE + " DO 1000 params")->ThreadRange(1, MAX
}
}

static void BM_INSERT_BATCH_WITH_PREPARE(benchmark::State& state) {
sql::Connection *conn = connect("");
static void BM_INSERT_BATCH_CLIENT_REWRITE(benchmark::State& state) {
sql::Connection *conn = connect("?rewriteBatchedStatements=true");
int numOperation = 0;
for (auto _ : state) {
insert_batch_with_prepare(state, conn);
Expand All @@ -337,7 +337,18 @@ BENCHMARK(BM_DO_1000_PARAMS)->Name(TYPE + " DO 1000 params")->ThreadRange(1, MAX
delete conn;
}

static void BM_INSERT_BATCH_WITH_PREPARE(benchmark::State& state) {
sql::Connection *conn = connect("?useServerPrepStmts=true");
int numOperation = 0;
for (auto _ : state) {
insert_batch_with_prepare(state, conn);
numOperation++;
}
state.counters[OPERATION_PER_SECOND_LABEL] = benchmark::Counter(numOperation, benchmark::Counter::kIsRate);
delete conn;
}
BENCHMARK(BM_INSERT_BATCH_WITH_PREPARE)->Name(TYPE + " insert batch looping execute")->ThreadRange(1, MAX_THREAD)->UseRealTime()->Setup(setup_insert_batch);
BENCHMARK(BM_INSERT_BATCH_CLIENT_REWRITE)->Name(TYPE + " insert batch client rewrite")->ThreadRange(1, MAX_THREAD)->UseRealTime()->Setup(setup_insert_batch);
#endif

BENCHMARK_MAIN();
Expand Down

0 comments on commit b9e3f99

Please sign in to comment.