Details
-
Task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
benchmarking different driver, this shows some part that might be improved :
|--------------|--------------|--------------|
|
| c | c | rust |
|
| mysql | mariadb | mysql |
|
------------------------------------------------------|--------------|--------------|--------------|
|
do 1000 parameters - BINARY EXECUTE ONLY | 29954 | 100% | 26881 | 90% | 29946 | 100% | |
------------------------------------------------------|--------------|--------------|--------------|
|
code for c is :
|
|
static void BM_DO_1000_PARAMS_BINARY(benchmark::State& state) { |
MYSQL *conn = connect(""); |
MYSQL_STMT *stmt = mysql_stmt_init(conn);
|
|
// Build query with 1000 placeholders: "DO ?,?,?..." |
std::string query = "DO ?"; |
for (int i = 1; i < 1000; i++) { |
query += ",?"; |
}
|
|
int rc; |
rc = mysql_stmt_prepare(stmt, query.c_str(), (unsigned long)query.size()); |
check_conn_rc(rc, conn);
|
|
|
int int_data[1000]; |
MYSQL_BIND my_bind[1000]; |
memset(my_bind, 0, sizeof(my_bind)); |
|
|
for (int i = 0; i < 1000; i++) { |
int_data[i] = i + 1; |
my_bind[i].buffer_type = MYSQL_TYPE_LONG;
|
my_bind[i].buffer = (char *) &int_data[i]; |
my_bind[i].is_null = 0; |
}
|
|
|
int numOperation = 0; |
for (auto _ : state) { |
do_1000_params_binary(state, conn, stmt, my_bind);
|
numOperation++;
|
}
|
state.counters[OPERATION_PER_SECOND_LABEL] = benchmark::Counter(numOperation, benchmark::Counter::kIsRate);
|
mysql_stmt_close(stmt);
|
mysql_close(conn);
|
}
|