-
Notifications
You must be signed in to change notification settings - Fork 3
/
CombineResults_Lags.R
212 lines (197 loc) · 5.44 KB
/
CombineResults_Lags.R
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
Path <- "C:/Users/Bizon/Documents/GitHub/rappwd/"
# Load Benchmark Files
datatable <- data.table::fread(paste0(Path, "BenchmarkResults_Lags.csv"))
polars <- data.table::fread(paste0(Path, "BenchmarkResultsPolars_Lags.csv"))
polars <- polars[, .SD, .SDcols = c("TimeInSeconds")]
duckdb <- data.table::fread(paste0(Path, "BenchmarkResultsDuckDB_Lags.csv"))
duckdb <- duckdb[, .SD, .SDcols = c("TimeInSeconds")]
pandas <- data.table::fread(paste0(Path, "BenchmarkResultsPandas_Lags.csv"))
pandas <- pandas[, .SD, .SDcols = c("TimeInSeconds")]
collapse <- data.table::fread(paste0(Path, "BenchmarkResultsCollapse_Lags.csv"))
collapse <- collapse[, .SD, .SDcols = c("TimeInSeconds")]
# Modify Column Names for Joining
data.table::setnames(datatable, "TimeInSeconds", "2_Datatable")
data.table::setnames(polars, "TimeInSeconds", "4_Polars")
data.table::setnames(duckdb, "TimeInSeconds", "5_DuckDB")
data.table::setnames(pandas, "TimeInSeconds", "3_Pandas")
data.table::setnames(collapse, "TimeInSeconds", "1_Collapse")
# Subset columns
datatable <- datatable[, .SD, .SDcols = c("Method", "Experiment", "2_Datatable")]
# Join data
dt <- cbind(
datatable,
polars,
duckdb,
pandas,
collapse)
# Prepare data for plotting
dt <- data.table::melt.data.table(
data = dt,
id.vars = c("Method", "Experiment"),
measure.vars = c(
"1_Collapse",
"2_Datatable",
"5_DuckDB",
"3_Pandas",
"4_Polars"),
value.name = "Time In Seconds")
dt[, `Time In Seconds` := round(`Time In Seconds`, 3)]
data.table::fwrite(dt, file = paste0(Path, "BenchmarkResultsPlot.csv"))
dt[, `Time In Seconds` := data.table::fifelse(`Time In Seconds` == -0.1, NA_real_, `Time In Seconds`)]
data.table::setorderv(dt, cols = "variable", -1)
temp <- data.table::copy(dt)
temp <- temp[Experiment != "Total Runtime"]
temp[, DataSize := sub(" .*", "", Experiment)]
temp <- temp[, list(`Total Run Time (secs)` = sum(`Time In Seconds`, na.rm = TRUE)), by = .(variable, DataSize)]
temp <- temp[order(DataSize, variable, `Total Run Time (secs)`)]
temp[, variable := gsub("^[^_]*_", "", variable)][]
# Add DataSize for filtering
dt[, DataSize := sub(" .*", "", Experiment)]
# Plot Totals
AutoPlots::Plot.Bar(
dt = temp,
PreAgg = TRUE,
XVar = "variable",
YVar = "Total Run Time (secs)",
GroupVar = "DataSize",
LabelValues = NULL,
YVarTrans = "Identity",
XVarTrans = "Identity",
FacetRows = 3,
FacetCols = 1,
FacetLevels = NULL,
AggMethod = "mean",
Height = NULL,
Width = NULL,
Title = "Windowing (lags)",
ShowLabels = TRUE,
Title.YAxis = NULL,
Title.XAxis = "",
EchartsTheme = "dark",
MouseScroll = TRUE,
TimeLine = TRUE,
TextColor = "white",
title.fontSize = 35,
title.fontWeight = "bold",
title.textShadowColor = "#63aeff",
title.textShadowBlur = 5,
title.textShadowOffsetY = 1,
title.textShadowOffsetX = -1,
xaxis.fontSize = 14,
yaxis.fontSize = 30,
xaxis.rotate = 0,
yaxis.rotate = 0,
ContainLabel = TRUE,
Debug = FALSE
)
# Plot 1M Case
echarts4r::e_flip_coords(AutoPlots::Plot.Bar(
dt = dt[DataSize == "1M"],
PreAgg = TRUE,
XVar = "Experiment",
YVar = "Time In Seconds",
GroupVar = "variable",
LabelValues = NULL,
YVarTrans = "Identity",
XVarTrans = "Identity",
FacetRows = 1,
FacetCols = 1,
FacetLevels = NULL,
AggMethod = "mean",
Height = NULL,
Width = NULL,
Title = "1M Rows Benchmark",
ShowLabels = TRUE,
Title.YAxis = NULL,
Title.XAxis = "",
EchartsTheme = "dark",
MouseScroll = TRUE,
TimeLine = TRUE,
TextColor = "white",
title.fontSize = 35,
title.fontWeight = "bold",
title.textShadowColor = "#63aeff",
title.textShadowBlur = 5,
title.textShadowOffsetY = 1,
title.textShadowOffsetX = -1,
xaxis.fontSize = 14,
yaxis.fontSize = 30,
xaxis.rotate = 0,
yaxis.rotate = 0,
ContainLabel = TRUE,
Debug = FALSE
))
# Plot 10M Case
echarts4r::e_flip_coords(AutoPlots::Plot.Bar(
dt = dt[DataSize == "10M"],
PreAgg = TRUE,
XVar = "Experiment",
YVar = "Time In Seconds",
GroupVar = "variable",
LabelValues = NULL,
YVarTrans = "Identity",
XVarTrans = "Identity",
FacetRows = 1,
FacetCols = 1,
FacetLevels = NULL,
AggMethod = "mean",
Height = NULL,
Width = NULL,
Title = "10M Rows Benchmark",
ShowLabels = TRUE,
Title.YAxis = NULL,
Title.XAxis = "",
EchartsTheme = "dark",
MouseScroll = TRUE,
TimeLine = TRUE,
TextColor = "white",
title.fontSize = 35,
title.fontWeight = "bold",
title.textShadowColor = "#63aeff",
title.textShadowBlur = 5,
title.textShadowOffsetY = 1,
title.textShadowOffsetX = -1,
xaxis.fontSize = 14,
yaxis.fontSize = 30,
xaxis.rotate = 0,
yaxis.rotate = 0,
ContainLabel = TRUE,
Debug = FALSE
))
# Plot 100M Case
echarts4r::e_flip_coords(AutoPlots::Plot.Bar(
dt = dt[DataSize == "100M"],
PreAgg = TRUE,
XVar = "Experiment",
YVar = "Time In Seconds",
GroupVar = "variable",
LabelValues = NULL,
YVarTrans = "Identity",
XVarTrans = "Identity",
FacetRows = 1,
FacetCols = 1,
FacetLevels = NULL,
AggMethod = "mean",
Height = NULL,
Width = NULL,
Title = "100M Rows Benchmark",
ShowLabels = TRUE,
Title.YAxis = NULL,
Title.XAxis = "",
EchartsTheme = "dark",
MouseScroll = TRUE,
TimeLine = TRUE,
TextColor = "white",
title.fontSize = 35,
title.fontWeight = "bold",
title.textShadowColor = "#63aeff",
title.textShadowBlur = 5,
title.textShadowOffsetY = 1,
title.textShadowOffsetX = -1,
xaxis.fontSize = 14,
yaxis.fontSize = 30,
xaxis.rotate = 0,
yaxis.rotate = 0,
ContainLabel = TRUE,
Debug = FALSE
))