File: select_100_cols.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 (25 lines) | stat: -rw-r--r-- 719 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
#!/usr/bin/env python3 -O
# -*- coding: utf-8 -*-

import pyperf


def select_100_cols(loops, conn, paramstyle):
    range_it = range(loops)
    t0 = pyperf.perf_counter()
    for value in range_it:
        cursor = conn.cursor()
        cursor.execute("select * FROM test100")
        rows = cursor.fetchall()
        del cursor, rows
    return pyperf.perf_counter() - t0

def select_100_cols_execute(loops, conn, paramstyle):
    range_it = range(loops)
    t0 = pyperf.perf_counter()
    for value in range_it:
        cursor = conn.cursor(binary=True)
        cursor.execute("select * FROM test100 WHERE 1 = ?", (1,))
        rows = cursor.fetchall()
        del cursor, rows
    return pyperf.perf_counter() - t0