Skip to content

Commit e6577e5

Browse files
authored
Merge pull request gousiosg#27 from bitslab/alekh
Updated RQ4 scripts for rpki-commons
2 parents 05d0abc + 526e1ef commit e6577e5

File tree

3 files changed

+70
-12
lines changed

3 files changed

+70
-12
lines changed

artifacts/experiments/RQ4/generateResults.py

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
import pandas as pd
77

88
BASE_RESULT_DIR = "artifacts/results/"
9-
PROJECTS = ["jflex", "convex", "mph-table"]
9+
PROJECTS = ["convex", "jflex", "mph-table", "rpki-commons"]
1010
REPORT_NAME = "artifacts/output/rq4.csv"
1111
TEX_REPORT_NAME = "artifacts/output/rq4.tex"
1212

13-
CALC_NAMES = ['Vanilla', 'Improved']
13+
RAW_NAMES = ['Vanilla', 'Improved']
14+
CALC_NAMES = ['Vanilla', 'Improved', 'Overhead']
1415

1516
propertyShortNames = {
1617
"TestSmartByteSerializer#canRoundTripBytes": 'byte',
@@ -31,7 +32,13 @@
3132
"CharClassesQuickcheck#addString": 'addString',
3233
"StateSetQuickcheck#addStateDoesNotRemove": 'add',
3334
"StateSetQuickcheck#containsElements": 'contains',
34-
"StateSetQuickcheck#removeAdd": 'remove'
35+
"StateSetQuickcheck#removeAdd": 'remove',
36+
"RoaCMSBuilderPropertyTest#buildEncodedParseCheck": 'roa',
37+
"ManifestCMSBuilderPropertyTest#buildEncodedParseCheck": 'manifest',
38+
"AspaCmsTest#should_generate_aspa": 'aspa',
39+
"X509ResourceCertificateParentChildValidatorTest#validParentChildSubResources": 'resources',
40+
"X509ResourceCertificateParentChildValidatorTest#validParentChildOverClaiming": 'claiming',
41+
"X509ResourceCertificateParentChildValidatorTest#validParentChildOverClaimingLooseValidation": 'loose'
3542
}
3643

3744
row_count = 1
@@ -45,6 +52,8 @@ def filter_for_recent_results(project_name: str, stats_directories: list[str]) -
4552
project_string = project_name if project_name != "convex" else project_name + "-core" # edge case
4653
if "mph-table-fixed" in stats_directories[0]: # edge case
4754
project_string = "mph-table-fixed"
55+
elif "rpki-commons-fixed" in stats_directories[0]:
56+
project_string = "rpki-commons-fixed"
4857
time_stamps = [datetime.datetime.strptime(x.replace(project_string, "").replace("_", ":").replace("T", " "), "%Y-%m-%d %H:%M:%S.%f")
4958
for x in stats_directories]
5059
time_stamps.sort()
@@ -88,11 +97,14 @@ def generate_report_stats(stat_values: dict[str, dict]) -> dict[str, str]:
8897
property_dict = {}
8998
for key in first_iteration:
9099
property_dict[key] = []
91-
100+
92101
# populate the dictionary with our results
93102
for key, val in stat_values.items():
94103
for prop, time in val.items():
95104
property_array = property_dict.get(prop)
105+
if property_array is None:
106+
property_dict[prop] = []
107+
property_array = property_dict.get(prop)
96108
property_array.append(time)
97109

98110
# generate mean, standard deviation and populate our final object
@@ -141,7 +153,7 @@ def main():
141153
fixed_stats_directories = obtain_stats_directories(results_directory=fixed_results_directory)
142154
evaluated_fixed_runs = filter_for_recent_results(project_name=project_name, stats_directories=fixed_stats_directories)
143155
fixed_raw_stats = evaluate_directories(project_name=fixed_project_name, results_directory=fixed_results_directory, directories=evaluated_fixed_runs)
144-
156+
145157
# obtain mean/st dev
146158
final_stats = generate_report_stats(stat_values=raw_stats)
147159
final_fixed_stats = generate_report_stats(stat_values=fixed_raw_stats)
@@ -153,21 +165,24 @@ def main():
153165
df = pd.DataFrame()
154166
for project in PROJECTS:
155167
final_dataset[project]['_style'] = ''
156-
proj_mean_and_std = final_dataset[project][CALC_NAMES].copy()
168+
proj_mean_and_std = final_dataset[project][RAW_NAMES].copy()
157169
vanilla_mean = pd.DataFrame(proj_mean_and_std['Vanilla'].apply(lambda v: float(v.split(" \u00B1 ")[0]) if
158170
" \u00B1 " in str(v) else np.nan)).reset_index()
159171
improved_mean = pd.DataFrame(proj_mean_and_std['Improved'].apply(lambda v: float(v.split(" \u00B1 ")[0]) if
160172
" \u00B1 " in str(v) else np.nan)).reset_index()
161173

162-
proj_stats = pd.merge(vanilla_mean.copy(), improved_mean.copy(), how='outer', on='index')[CALC_NAMES]
163-
final_dataset[project]['Difference'] = proj_stats[['Vanilla', 'Improved']].pct_change(axis='columns')['Improved']
164-
proj_mean = pd.merge(vanilla_mean, improved_mean, how='outer', on='index')[CALC_NAMES].mean()
174+
proj_stats = pd.merge(vanilla_mean, improved_mean, how='outer', on='index')[RAW_NAMES].reset_index()
175+
176+
final_dataset[project]['Overhead'] = proj_stats[['Improved']].values / proj_stats[['Vanilla']].values
177+
overhead_stats = final_dataset[project]['Overhead'].copy().reset_index()
178+
179+
proj_mean = pd.merge(proj_stats, overhead_stats, how='outer', on='index')[CALC_NAMES].mean()
165180
proj_mean['_style'] = 'BOLD'
166181
proj_mean['N'] = ''
167182
proj_mean['Property'] = 'Average'
168183
final_dataset[project].loc['mean'] = proj_mean
169184

170-
header = dict(zip(['N', 'Property', 'Vanilla', 'Improved', 'Difference'], ['', '', '', '', '']))
185+
header = dict(zip(['N', 'Property', 'Vanilla', 'Improved', 'Overhead'], ['', '', '', '', '']))
171186
df = pd.concat([
172187
df,
173188
pd.DataFrame(header | {'_style': 'HEADER', 'Property': project}, index=[0]),
@@ -203,6 +218,5 @@ def main():
203218
tf.write(outTable)
204219

205220

206-
207221
if __name__ == "__main__":
208222
main()

artifacts/output/rq4.tex

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
\begin{tabular}{lllll}
2+
N & Property & Vanilla & Improved & Overhead \\
3+
\hline
4+
\multicolumn{5}{c}{convex} \\
5+
\hline
6+
1 & message & 45.22 ± 3.36 & 42.80 ± 2.70 & 0.95 \\
7+
2 & data & 53.02 ± 1.99 & 53.92 ± 0.00 & 1.02 \\
8+
3 & primitive & 48.52 ± 0.88 & 50.12 ± 0.00 & 1.03 \\
9+
\textbf{} & \textbf{Average} & \textbf{48.92} & \textbf{48.95} & \textbf{1.00} \\
10+
\hline
11+
\multicolumn{5}{c}{jflex} \\
12+
\hline
13+
1 & remove & 41.50 ± 6.41 & 31.56 ± 5.16 & 0.76 \\
14+
2 & addSingleton & 44.89 ± 0.77 & 51.57 ± 0.79 & 1.15 \\
15+
3 & contains & 43.82 ± 2.12 & 42.61 ± 1.68 & 0.97 \\
16+
4 & addSet & 44.56 ± 0.94 & 52.82 ± 0.87 & 1.19 \\
17+
5 & add & 43.06 ± 1.84 & 43.10 ± 1.80 & 1.00 \\
18+
6 & addString & 44.93 ± 1.64 & 51.53 ± 1.59 & 1.15 \\
19+
7 & addSingle & 44.40 ± 2.21 & 53.14 ± 1.53 & 1.20 \\
20+
\textbf{} & \textbf{Average} & \textbf{43.88} & \textbf{46.62} & \textbf{1.06} \\
21+
\hline
22+
\multicolumn{5}{c}{mph-table} \\
23+
\hline
24+
1 & list & 13.49 ± 0.98 & 13.19 ± 0.94 & 0.98 \\
25+
2 & optionals & 12.75 ± 0.76 & 13.17 ± 1.08 & 1.03 \\
26+
3 & short & 12.68 ± 0.67 & 13.16 ± 0.58 & 1.04 \\
27+
4 & int & 13.09 ± 0.81 & 12.79 ± 1.00 & 0.98 \\
28+
5 & pair & 12.76 ± 0.81 & 13.16 ± 1.09 & 1.03 \\
29+
6 & byte & 12.57 ± 0.79 & 12.85 ± 1.04 & 1.02 \\
30+
7 & long & 12.80 ± 0.75 & 13.04 ± 0.91 & 1.02 \\
31+
8 & string & 12.73 ± 0.60 & 12.99 ± 0.97 & 1.02 \\
32+
9 & list* & nan & 27.19 ± 3.60 & nan \\
33+
\textbf{} & \textbf{Average} & \textbf{12.86} & \textbf{14.62} & \textbf{1.01} \\
34+
\hline
35+
\multicolumn{5}{c}{rpki-commons} \\
36+
\hline
37+
1 & claiming & 25.33 ± 2.37 & nan & nan \\
38+
2 & aspa & 23.42 ± 1.72 & nan & nan \\
39+
3 & resources & 24.18 ± 1.60 & 26.14 ± 0.28 & 1.08 \\
40+
4 & roa & 24.29 ± 3.24 & nan & nan \\
41+
5 & manifest & 23.41 ± 2.44 & nan & nan \\
42+
6 & loose & 25.48 ± 2.62 & nan & nan \\
43+
\textbf{} & \textbf{Average} & \textbf{24.35} & \textbf{26.14} & \textbf{1.08} \\
44+
\end{tabular}

run_experiment_rq4.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GEN_STATS="artifacts/experiments/RQ4/generateStats.py"
22
GEN_RESULTS="artifacts/experiments/RQ4/generateResults.py"
3-
for PROJECT in mph-table convex jflex
3+
for PROJECT in convex jflex mph-table rpki-commons
44
do
55
echo Generating statistics for $PROJECT
66
python3 $GEN_STATS $PROJECT

0 commit comments

Comments
 (0)