-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathrun_benchmarks.py
51 lines (43 loc) · 1.47 KB
/
run_benchmarks.py
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
import argparse
from time import time
from benchmarks.benchmarks import (
Aggregate1,
DateFormat,
DateParse,
DatetimeFormat,
DatetimeParse,
GetDefault,
GroupBy1,
IterOfIter1,
TableDictReader,
)
from benchmarks.storage import BenchmarkResultsStorage
BENCHMARKS = [
# fmt: off
type("GetDefaultPositive", (GetDefault,), {"POSITIVE": True})(),
type("GetDefaultNegative", (GetDefault,), {"POSITIVE": False})(),
Aggregate1(),
GroupBy1(GroupBy1.Modes.FEW_GROUPS),
GroupBy1(GroupBy1.Modes.MANY_GROUPS),
IterOfIter1(),
TableDictReader(),
type("DateParse1", (DateParse,), {"FMT": "%m/%d/%Y"})(),
type("DateParse2", (DateParse,), {"FMT": "%Y-%m-%d"})(),
type("DatetimeParse1", (DatetimeParse,), {"FMT": "%m/%d/%Y %I:%M %p"})(),
type("DatetimeParse2", (DatetimeParse,), {"FMT": "%Y-%m-%dt%H:%M:%S.%f"})(),
type("DateFormat1", (DateFormat,), {"FMT": "%Y-%m-%d"})(),
type("DateFormat2", (DateFormat,), {"FMT": "%m/%d/%Y"})(),
type("DatetimeFormat1", (DatetimeFormat,), {"FMT": "%m/%d/%Y %I:%M %p"})(),
type("DatetimeFormat2", (DatetimeFormat,), {"FMT": "%Y-%m-%dT%H:%M:%S.%f"})(),
# fmt: on
]
def run():
storage = BenchmarkResultsStorage()
print("WARMING UP")
for benchmark in BENCHMARKS[:2]:
benchmark.get_execution_result(silent=True)
for benchmark in BENCHMARKS:
storage.add_item(benchmark.get_execution_result())
storage.save()
if __name__ == "__main__":
run()