File: internal_bench.py

package info (click to toggle)
mariadb-connector-python 1.1.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 812 kB
  • sloc: python: 6,246; ansic: 4,971; sh: 23; makefile: 14
file content (35 lines) | stat: -rw-r--r-- 1,231 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env python3 -O
# -*- coding: utf-8 -*-

import pyperf
import os

from benchmarks.benchmark.bulk import bulk
from benchmarks.benchmark.do_1 import do1
from benchmarks.benchmark.select_1 import select_1
from benchmarks.benchmark.do_1000_param import do_1000_param
from benchmarks.benchmark.select_100_cols import select_100_cols, select_100_cols_execute
from benchmarks.benchmark.select_1000_rows import select_1000_rows


def run_test(tests, conn, paramstyle):
    runner = pyperf.Runner(warmups=1000, processes=1, min_time=10)
    for test in tests:
        runner.bench_time_func(test['label'], test['method'], conn, paramstyle)

def test_suite(paramstyle):
    ts = [
        {'label': 'BULK Insert',
                  'method': bulk},
        {'label': 'DO 1',
                  'method': do1},
        {'label': 'DO 1000 params',
                  'method': do_1000_param},
        {'label': 'select_100_cols',
                  'method': select_100_cols},
        {'label': 'select 1', 'method': select_1},
        {'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