mirror of
https://github.com/mariadb-corporation/mariadb-connector-python.git
synced 2025-07-27 13:01:19 +00:00
[misc] correcting benchmark using binary
This commit is contained in:
@ -109,11 +109,11 @@ script:
|
|||||||
else
|
else
|
||||||
pip install mysql-connector-python pymysql pyperf
|
pip install mysql-connector-python pymysql pyperf
|
||||||
export TEST_MODULE=mariadb
|
export TEST_MODULE=mariadb
|
||||||
python bench_init.py
|
python bench_init.py --inherit-environ=TEST_MODULE,TEST_DB_USER,TEST_DB_HOST,TEST_DB_DATABASE,TEST_DB_PORT,TEST_REQUIRE_TLS,TEST_DB_PASSWORD --copy-env
|
||||||
python bench.py -o mariadb_bench.json --inherit-environ=TEST_MODULE,TEST_DB_USER,TEST_DB_HOST,TEST_DB_DATABASE,TEST_DB_PORT,TEST_REQUIRE_TLS,TEST_DB_PASSWORD
|
python bench.py -o mariadb_bench.json --inherit-environ=TEST_MODULE,TEST_DB_USER,TEST_DB_HOST,TEST_DB_DATABASE,TEST_DB_PORT,TEST_REQUIRE_TLS,TEST_DB_PASSWORD --copy-env
|
||||||
export TEST_MODULE=mysql.connector
|
export TEST_MODULE=mysql.connector
|
||||||
python bench.py -o mysql-connector-python_bench.json --inherit-environ=TEST_MODULE,TEST_DB_USER,TEST_DB_HOST,TEST_DB_DATABASE,TEST_DB_PORT,TEST_REQUIRE_TLS,TEST_DB_PASSWORD
|
python bench.py -o mysql-connector-python_bench.json --inherit-environ=TEST_MODULE,TEST_DB_USER,TEST_DB_HOST,TEST_DB_DATABASE,TEST_DB_PORT,TEST_REQUIRE_TLS,TEST_DB_PASSWORD --copy-env
|
||||||
export TEST_MODULE=pymysql
|
export TEST_MODULE=pymysql
|
||||||
python bench.py -o pymysql_bench.json --inherit-environ=TEST_MODULE,TEST_DB_USER,TEST_DB_HOST,TEST_DB_DATABASE,TEST_DB_PORT,TEST_REQUIRE_TLS,TEST_DB_PASSWORD
|
python bench.py -o pymysql_bench.json --inherit-environ=TEST_MODULE,TEST_DB_USER,TEST_DB_HOST,TEST_DB_DATABASE,TEST_DB_PORT,TEST_REQUIRE_TLS,TEST_DB_PASSWORD --copy-env
|
||||||
python -m pyperf compare_to pymysql_bench.json mysql-connector-python_bench.json mariadb_bench.json --table
|
python -m pyperf compare_to pymysql_bench.json mysql-connector-python_bench.json mariadb_bench.json --table
|
||||||
fi
|
fi
|
||||||
|
@ -18,11 +18,8 @@ def select_100_cols_execute(loops, conn, paramstyle):
|
|||||||
range_it = range(loops)
|
range_it = range(loops)
|
||||||
t0 = pyperf.perf_counter()
|
t0 = pyperf.perf_counter()
|
||||||
for value in range_it:
|
for value in range_it:
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor(binary=True)
|
||||||
if paramstyle == 'qmark':
|
cursor.execute("select * FROM test100 WHERE 1 = ?", (1,))
|
||||||
cursor.execute("select * FROM test100 WHERE 1 = ?", (1,))
|
|
||||||
else:
|
|
||||||
cursor.execute("select * FROM test100 WHERE 1 = %s", [1])
|
|
||||||
rows = cursor.fetchall()
|
rows = cursor.fetchall()
|
||||||
del cursor, rows
|
del cursor, rows
|
||||||
return pyperf.perf_counter() - t0
|
return pyperf.perf_counter() - t0
|
||||||
|
@ -18,7 +18,6 @@ def run_test(tests, conn, paramstyle):
|
|||||||
runner.bench_time_func(test['label'], test['method'], conn, paramstyle)
|
runner.bench_time_func(test['label'], test['method'], conn, paramstyle)
|
||||||
|
|
||||||
def test_suite(paramstyle):
|
def test_suite(paramstyle):
|
||||||
is_mysql = int(os.environ.get('TEST_MYSQL', '1'))
|
|
||||||
ts = [
|
ts = [
|
||||||
{'label': 'BULK Insert',
|
{'label': 'BULK Insert',
|
||||||
'method': bulk},
|
'method': bulk},
|
||||||
@ -28,9 +27,9 @@ def test_suite(paramstyle):
|
|||||||
'method': do_1000_param},
|
'method': do_1000_param},
|
||||||
{'label': 'select_100_cols',
|
{'label': 'select_100_cols',
|
||||||
'method': select_100_cols},
|
'method': select_100_cols},
|
||||||
{'label': 'select_100_cols_execute',
|
|
||||||
'method': select_100_cols_execute},
|
|
||||||
{'label': 'select 1', 'method': select_1},
|
{'label': 'select 1', 'method': select_1},
|
||||||
{'label': 'select_1000_rows', 'method': select_1000_rows},
|
{'label': 'select_1000_rows', 'method': select_1000_rows},
|
||||||
]
|
]
|
||||||
|
if paramstyle == 'qmark':
|
||||||
|
ts.append({'label': 'select_100_cols_execute', 'method': select_100_cols_execute})
|
||||||
return ts
|
return ts
|
||||||
|
@ -30,6 +30,11 @@ def init_db(conn, paramstyle):
|
|||||||
cursor.executemany("INSERT INTO num_test VALUES (%s,%s,%s,%s,%s,%s)",
|
cursor.executemany("INSERT INTO num_test VALUES (%s,%s,%s,%s,%s,%s)",
|
||||||
vals)
|
vals)
|
||||||
|
|
||||||
|
|
||||||
|
cursor.execute("DROP TABLE IF EXISTS test100")
|
||||||
|
cursor.execute("CREATE TABLE test100 (i1 int,i2 int,i3 int,i4 int,i5 int,i6 int,i7 int,i8 int,i9 int,i10 int,i11 int,i12 int,i13 int,i14 int,i15 int,i16 int,i17 int,i18 int,i19 int,i20 int,i21 int,i22 int,i23 int,i24 int,i25 int,i26 int,i27 int,i28 int,i29 int,i30 int,i31 int,i32 int,i33 int,i34 int,i35 int,i36 int,i37 int,i38 int,i39 int,i40 int,i41 int,i42 int,i43 int,i44 int,i45 int,i46 int,i47 int,i48 int,i49 int,i50 int,i51 int,i52 int,i53 int,i54 int,i55 int,i56 int,i57 int,i58 int,i59 int,i60 int,i61 int,i62 int,i63 int,i64 int,i65 int,i66 int,i67 int,i68 int,i69 int,i70 int,i71 int,i72 int,i73 int,i74 int,i75 int,i76 int,i77 int,i78 int,i79 int,i80 int,i81 int,i82 int,i83 int,i84 int,i85 int,i86 int,i87 int,i88 int,i89 int,i90 int,i91 int,i92 int,i93 int,i94 int,i95 int,i96 int,i97 int,i98 int,i99 int,i100 int)")
|
||||||
|
cursor.execute("INSERT INTO test100 value (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100)")
|
||||||
|
|
||||||
cursor.execute("DROP TABLE IF EXISTS perfTestTextBatch")
|
cursor.execute("DROP TABLE IF EXISTS perfTestTextBatch")
|
||||||
try:
|
try:
|
||||||
cursor.execute("INSTALL SONAME 'ha_blackhole'")
|
cursor.execute("INSTALL SONAME 'ha_blackhole'")
|
||||||
|
Reference in New Issue
Block a user