-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_plot.py
More file actions
126 lines (97 loc) · 3.57 KB
/
test_plot.py
File metadata and controls
126 lines (97 loc) · 3.57 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
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
from matplotlib.font_manager import FontProperties
from pylab import *
capacity = [1000, 10000, 100000, 300000, 800000, 1000000]
# NSMutableDictipnary
deleteNative = [105, 35, 76, 106, 101, 63]
insertNative = [3154, 101, 347, 75, 135, 108]
searchNative = [48, 37, 53, 41, 41, 85]
plot(capacity, deleteNative, c = 'red', label = 'delete', alpha = 0.5, lw = 2)
plot(capacity, insertNative, c = 'green', label = 'insert', alpha = 0.5, lw = 2)
plot(capacity, searchNative, c = 'blue', label = 'search', alpha = 0.5, lw = 2)
title('NSMutableDictionary')
xlabel('elements count')
ylabel('time, nanoseconds')
legend()
grid(True)
show()
# CustomMutableDictionary
deleteCustom = [362, 4122, 3408, 1106, 1930, 1956]
insertCustom = [503, 488, 499, 768, 578, 412]
searchCustom = [91, 89, 2144, 170, 1510, 524]
plot(capacity, deleteCustom, c = 'red', label = 'delete', alpha = 0.5, lw = 2)
plot(capacity, insertCustom, c = 'green', label = 'insert', alpha = 0.5, lw = 2)
plot(capacity, searchCustom, c = 'blue', label = 'search', alpha = 0.5, lw = 2)
title('CustomMutableDictionary')
xlabel('elements count')
ylabel('time, nanoseconds')
legend()
grid(True)
show()
# NSMutableArray
insertAtStartNative = [46, 21, 16, 23, 21, 17]
insertAtEndNative = [30, 23, 20, 33, 21, 30]
randomRemoveNative = [428, 1830, 30914, 113080, 372899, 623904]
removeLastNative = [160, 121, 98, 128, 116, 112]
indexOfObjectNative = [60623, 666612, 6561044, 20468103, 49655793, 61725194]
objectAtIndexNative = [21, 27, 13, 15, 15, 16]
plot(capacity, insertAtStartNative, c = 'red', label = 'insert at start', lw = 2)
plot(capacity, insertAtEndNative, c = 'green', label = 'insert at end', lw = 2)
plot(capacity, randomRemoveNative, c = 'blue', label = 'random remove', lw = 2)
plot(capacity, removeLastNative, c = 'c', label = 'remove last', lw = 2)
plot(capacity, indexOfObjectNative, c = 'black', label = 'random access by object', lw = 2)
plot(capacity, objectAtIndexNative, c = 'magenta', label = 'random acces by index', lw = 2)
title('NSMutableArray')
xlabel('elements count')
ylabel('time, nanoseconds')
legend()
grid(True)
show()
# CustomMutableArray
insertAtStartCustom = [323, 3374, 83973, 132249, 836776, 1045885]
insertAtEndCustom = [151, 32, 44, 51, 70, 43]
randomRemoveCustom = [3020, 80400, 1137389, 3038842, 8414748, 11051069]
removeLastCustom = [200, 100, 94, 105, 110, 104]
indexOfObjectCustom = [77322, 707752, 7548987, 20103244, 52146460, 65193573]
objectAtIndexCustom = [ 25, 12, 11, 13, 13, 25]
plot(capacity, insertAtStartCustom, c = 'red', label = 'insert at start', lw = 2)
title('CustomMutableArray')
xlabel('elements count')
ylabel('time, nanoseconds')
legend()
grid(True)
show()
plot(capacity, insertAtEndCustom, c = 'green', label = 'insert at end', lw = 2)
title('CustomMutableArray')
xlabel('elements count')
ylabel('time, nanoseconds')
legend()
grid(True)
show()
plot(capacity, randomRemoveCustom, c = 'blue', label = 'random remove', lw = 2)
title('CustomMutableArray')
xlabel('elements count')
ylabel('time, nanoseconds')
legend()
grid(True)
show()
plot(capacity, removeLastCustom, c = 'c', label = 'remove last', lw = 2)
title('CustomMutableArray')
xlabel('elements count')
ylabel('time, nanoseconds')
legend()
grid(True)
show()
plot(capacity, indexOfObjectCustom, c = 'black', label = 'random access by object', lw = 2)
title('CustomMutableArray')
xlabel('elements count')
ylabel('time, nanoseconds')
legend()
grid(True)
show()
plot(capacity, objectAtIndexCustom, c = 'magenta', label = 'random acces by index', lw = 2)
title('CustomMutableArray')
xlabel('elements count')
ylabel('time, nanoseconds')
legend()
grid(True)
show()