File: benchmark_functions.py

package info (click to toggle)
python-pyperform 1.86-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 168 kB
  • sloc: python: 729; makefile: 17
file content (27 lines) | stat: -rw-r--r-- 540 bytes parent folder | download
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
__author__ = 'Calvin'
from pyperform import ComparisonBenchmark, BenchmarkedFunction


@ComparisonBenchmark('Group1', largs=(100,))
def mytest(l):
    out = 0.
    for i in range(l):
        out += i
    return out

@ComparisonBenchmark('Group1', largs=(100,))
def mytest2(l):
    out = 0.
    for i in range(l):
        out += i

    return out

@BenchmarkedFunction(largs=(5, 2, 10))
def TripleMultiply(a, b, c):
    result = a * b * c
    return result

with open('report.txt', 'w') as f:
    ComparisonBenchmark.summarize('Group1', f)