-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsa-density-median50.py
More file actions
executable file
·61 lines (46 loc) · 2.04 KB
/
Copy pathmsa-density-median50.py
File metadata and controls
executable file
·61 lines (46 loc) · 2.04 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
#!/usr/bin/env python3
import re
import matplotlib.pyplot as plt
from pathlib import Path
from matplotlib.lines import Line2D
import matplotlib.patches as mpatches
from matplotlib.figure import figaspect
nodes = [500]
degrees = [0.01, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
weights = [1000]
text = Path("msa-density-median50.bench").read_text()
lines = [line for line in text.splitlines()][3:]
searches = [re.search("BM_(.*)/(\d+)/(\d+)/(\d+) *(\d+) *.*", l) for l in lines]
groups = [s.groups() for s in searches if s]
values = dict()
for (name, n,d,w,t) in groups:
if name not in values: values[name] = []
values[name].append((nodes[int(n)], degrees[int(d)], weights[int(w)], int(t)))
fig, ax = plt.subplots(figsize=(10,5))
def add(name, nodes, color, linestyle):
x = [v[1] for v in values[name] if v[0] == nodes]
y = [v[3] for v in values[name] if v[0] == nodes]
#ax.scatter(x, y, c=color, marker=linestyle)
ax.plot(x, y, color=color, linestyle=linestyle)
add('Edmonds2Heap', 500, "red", "-")
add('EdmondsD8Heap', 500, "blue", "-")
add('EdmondsD16Heap', 500, "green", "-")
add('EdmondsD64Heap', 500, "purple", "-")
add('EdmondsFHeap', 500, "black", ":")
edmonds_d2heap = Line2D([0], [0], label='edmonds 2-heap', color='red', linestyle='-')
edmonds_d8heap = Line2D([0], [0], label='edmonds 8-heap', color='blue', linestyle='-')
edmonds_d16heap = Line2D([0], [0], label='edmonds 16-heap', color='green', linestyle='-')
edmonds_d64heap = Line2D([0], [0], label='edmonds 64-heap', color='purple', linestyle='-')
edmonds_fheap = Line2D([0], [0], label='edmonds f-heap', color='black', linestyle=':')
dummy = Line2D([0],[0],color="w")
ax.legend(handles=[
edmonds_d2heap, edmonds_d8heap, edmonds_d16heap, edmonds_d64heap,
edmonds_fheap, dummy, dummy, dummy
], ncol=2)
ax.axis([0.0, 1.01, 7*10**4, 2*10**9])
ax.set_xticks([0.01, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0])
plt.yscale("log", base=10)
plt.xlabel("Density")
plt.ylabel("Time [ns]")
#plt.show()
plt.savefig('msa-density-median50.pdf', bbox_inches='tight')