-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEntryPoint.py
More file actions
80 lines (61 loc) · 2.8 KB
/
EntryPoint.py
File metadata and controls
80 lines (61 loc) · 2.8 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
from .SimpleStatistics import MonoProcessingClass
from .CreateDataframeClass import CreateDataFrame
from .MultiProc import MultiProcessingClass
from .CreatePlottingClass import PlotTimes
import multiprocessing
class Benchmark():
def __init__(self):
pass
def SimpleStatistics(self, n_cores, rows, start):
'''Call mono and multi simple statistical functions'''
self.create_df = CreateDataFrame()
self.df = self.create_df.create_df(rows, start)
self.mono = MonoProcessingClass()
self.mono.MonoSimpleStatistics(self.df)
self.multi = MultiProcessingClass()
self.multi.MultiSimpleStatistics(self.df, n_cores)
self.plot = PlotTimes()
self.plot.plot_simpleStatistics()
def utilFunctions(self, val, n_cores, rows, other_df_rows, first_df_start, sec_df_start):
'''Call mono and multi utility functions'''
self.create_df = CreateDataFrame()
self.df = self.create_df.create_df(rows, first_df_start)
self.df_other = self.create_df.create_another_df(other_df_rows,sec_df_start)
self.mono = MonoProcessingClass()
self.mono.MonoUtilityFunctions(self.df, self.df_other, val)
self.multi = MultiProcessingClass()
self.multi.multiUtilityFunctions(self.df, self.df_other, val, n_cores)
self.plot = PlotTimes()
self.plot.plot_utilFunctions()
def agg_without_loop(self, n_cores, rows, first_df_start):
# """Call aggregation functions without loops"""
self.create_df = CreateDataFrame()
self.df = self.create_df.create_df(rows,first_df_start)
self.mono = MonoProcessingClass()
self.mono.groupByAggregateNoLoop(self.df)
self.multi = MultiProcessingClass()
self.multi.multiAggregateNoLoop(self.df, n_cores)
self.plot = PlotTimes()
self.plot.plot_agg_no_loop()
def agg_with_loops(self, n_cores, rows, first_df_start):
"""Call aggregation functions with loops"""
self.create_df = CreateDataFrame()
self.df = self.create_df.create_df(rows, first_df_start)
self.mono = MonoProcessingClass()
self.mono.groupByAggregateLoop(self.df)
self.multi = MultiProcessingClass()
self.multi.multiAggregateLoop(self.df, n_cores)
self.plot = PlotTimes()
self.plot.plot_agg_loop()
if __name__ == '__main__':
n_cores = multiprocessing.cpu_count()
val = 96.50
rows = 375000
other_df_rows = 375000
first_df_start = '01-02-2020'
second_df_start = '02-15-2020'
bench = Benchmark()
bench.SimpleStatistics(n_cores, rows, first_df_start)
bench.utilFunctions(val, n_cores, rows, other_df_rows, first_df_start, second_df_start)
bench.agg_without_loop(n_cores, rows, first_df_start)
bench.agg_with_loops(n_cores, rows, first_df_start)