forked from ellisk42/ec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
graphVersionSizes.py
72 lines (59 loc) · 1.75 KB
/
graphVersionSizes.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import matplotlib.pyplot as plot
import math
import sys
import re
plot.figure()
A = len(sys.argv) - 1
assert A == 3
for a,fn in enumerate(sys.argv[1:]):
print(fn)
ss = []
hs = []
cs = []
es = []
with open(fn,"r") as handle:
for l in handle:
if not l.startswith("DATA"):
continue
try:
size = re.search("size=([^\s]+)\s",l)[1]
height = re.search("height=([^\s]+)\s",l)[1]
compressed = re.search("\|vs\|=([^\s]+)\s",l)[1]
expanded = re.search("\|\[vs\]\|=([^\s]+)",l)[1]
print(l)
print(size, height, compressed, expanded)
ss.append(int(size))
hs.append(int(height))
cs.append(int(compressed))
es.append(math.e**float(expanded))
except:
print("ERROR:")
print(l)
sys.exit(0)
plot.subplot(A,3,1 + a*3)
plot.title(" ")
plot.scatter(ss,cs)
#plot.gca().set_yscale('log')
plot.xlabel("expression size")
plot.ylabel("version space size")
if False:
plot.subplot(2,2,2)
plot.title(" ")
plot.scatter(hs,cs)
#plot.gca().set_yscale('log')
plot.xlabel("expression height")
plot.ylabel("version space size")
plot.subplot(A,3,2 + a*3)
plot.scatter(cs,es)
plot.gca().set_yscale('log')
#plot.gca().set_xscale('log')
plot.title(f"{a+1} refactoring steps")
plot.xlabel("version space size")
plot.ylabel("# refactorings")
plot.subplot(A,3,3 + a*3)
plot.title(" ")
plot.scatter(ss,es)
plot.gca().set_yscale('log')
plot.xlabel("expression size")
plot.ylabel("# refactorings")
plot.show()