Files
mariadb-connector-python/testing/benchmarks/internal_bench.py
Georg Richter 29b05e3b09 Various fixes and changes for SQLAlchemy support:
- added a thin python wrapper around mariadb module
- added constansts under mariadb.constants (CLIENT, CURSOR, INDICATOR)
- bench and test are now in testing subdirectory
- updated documentation
2020-07-24 12:13:31 +02:00

39 lines
1.4 KiB
Python

#!/usr/bin/env python3 -O
# -*- coding: utf-8 -*-
import pyperf, os
from benchmarks.benchmark.do_1 import do1
from benchmarks.benchmark.fetch import *
from benchmarks.benchmark.select_1 import select_1
from benchmarks.benchmark.select_param import select_param
from benchmarks.benchmark.select_10_cols_from_seq_1_to_10000 import \
select_10_cols_from_seq_1_to_10000
from benchmarks.benchmark.select_1_mysql_user import select_1_mysql_user
from benchmarks.benchmark.bulk import bulk
def run_test(tests, conn):
runner = pyperf.Runner()
for test in tests:
runner.bench_time_func(test['label'], test['method'], conn)
def test_suite():
is_mysql= int(os.environ.get('TEST_MYSQL', '1'))
ts= [
{'label': 'str_fetchloop', 'method': str_fetchloop},
{'label': 'str_fetchall', 'method': str_fetchall},
{'label': 'num_fetchloop', 'method': num_fetchloop},
{'label': 'num_fetchall', 'method': num_fetchall},
{'label': 'select 1', 'method': select_1},
{'label': 'select param', 'method': select_param},
{'label': 'bulk: insert/update/delete', 'method': bulk},
]
if is_mysql == 1:
ts.append({'label': 'select 1 mysql user', 'method': select_1_mysql_user})
ts.append({'label': 'do 1', 'method': do1})
ts.append({'label': 'Select <10 cols of 100 chars> from_seq_1_to_100000', 'method':
select_10_cols_from_seq_1_to_10000})
return ts