File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -125,3 +125,42 @@ func TestVLANUnmarshalBinary(t *testing.T) {
125125 }
126126 }
127127}
128+
129+ // Benchmarks for VLAN.MarshalBinary
130+
131+ func BenchmarkVLANMarshalBinary (b * testing.B ) {
132+ v := & VLAN {
133+ Priority : PriorityBackground ,
134+ ID : 10 ,
135+ }
136+
137+ b .ResetTimer ()
138+ b .ReportAllocs ()
139+ for i := 0 ; i < b .N ; i ++ {
140+ if _ , err := v .MarshalBinary (); err != nil {
141+ b .Fatal (err )
142+ }
143+ }
144+ }
145+
146+ // Benchmarks for VLAN.UnmarshalBinary
147+
148+ func BenchmarkVLANUnmarshalBinary (b * testing.B ) {
149+ v := & VLAN {
150+ Priority : PriorityBestEffort ,
151+ ID : 20 ,
152+ }
153+
154+ vb , err := v .MarshalBinary ()
155+ if err != nil {
156+ b .Fatal (err )
157+ }
158+
159+ b .ResetTimer ()
160+ b .ReportAllocs ()
161+ for i := 0 ; i < b .N ; i ++ {
162+ if err := v .UnmarshalBinary (vb ); err != nil {
163+ b .Fatal (err )
164+ }
165+ }
166+ }
You can’t perform that action at this time.
0 commit comments