You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// A box `Data`. Intentionally turns the value type into a reference, so we can make a promise that the inner value is not copied due to mutation during a test of insertion or replacing.
49
+
classTwoDatasBox{
50
+
vard1:Data
51
+
vard2:Data
52
+
53
+
init(d1:Data, d2:Data){
54
+
self.d1 = d1
55
+
self.d2 = d2
56
+
}
57
+
}
58
+
59
+
// MARK: -
60
+
61
+
Benchmark("DataEqualEmpty", closure:{ benchmark, box in
62
+
blackHole(box.d1 == box.d2)
63
+
}, setup:{()->TwoDatasBoxin
64
+
letd1=Data()
65
+
letd2= d1
66
+
letbox=TwoDatasBox(d1: d1, d2: d2)
67
+
return box
68
+
})
69
+
70
+
Benchmark("DataEqualInline", closure:{ benchmark, box in
71
+
blackHole(box.d1 == box.d2)
72
+
}, setup:{()->TwoDatasBoxin
73
+
letd1=createSomeData(12) // Less than size of InlineData.Buffer
74
+
letd2= d1
75
+
letbox=TwoDatasBox(d1: d1, d2: d2)
76
+
return box
77
+
})
78
+
79
+
Benchmark("DataNotEqualInline", closure:{ benchmark, box in
80
+
blackHole(box.d1 != box.d2)
81
+
}, setup:{()->TwoDatasBoxin
82
+
letd1=createSomeData(12) // Less than size of InlineData.Buffer
83
+
letd2=createSomeData(12)
84
+
letbox=TwoDatasBox(d1: d1, d2: d2)
85
+
return box
86
+
})
87
+
88
+
Benchmark("DataEqualLarge", closure:{ benchmark, box in
89
+
blackHole(box.d1 == box.d2)
90
+
}, setup:{()->TwoDatasBoxin
91
+
letd1=createSomeData(1024*8)
92
+
letd2= d1
93
+
letbox=TwoDatasBox(d1: d1, d2: d2)
94
+
return box
95
+
})
96
+
97
+
Benchmark("DataNotEqualLarge", closure:{ benchmark, box in
98
+
blackHole(box.d1 != box.d2)
99
+
}, setup:{()->TwoDatasBoxin
100
+
letd1=createSomeData(1024*8)
101
+
letd2=createSomeData(1024*8)
102
+
letbox=TwoDatasBox(d1: d1, d2: d2)
103
+
return box
104
+
})
105
+
106
+
Benchmark("DataEqualReallyLarge", closure:{ benchmark, box in
107
+
blackHole(box.d1 == box.d2)
108
+
}, setup:{()->TwoDatasBoxin
109
+
letd1=createSomeData(1024*1024*8)
110
+
letd2= d1
111
+
letbox=TwoDatasBox(d1: d1, d2: d2)
112
+
return box
113
+
})
114
+
115
+
Benchmark("DataNotEqualReallyLarge", closure:{ benchmark, box in
0 commit comments