File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
pkg/controller/priorityqueue Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -300,6 +300,34 @@ func BenchmarkAddGetDone(b *testing.B) {
300
300
}
301
301
}
302
302
303
+ func BenchmarkAddOnly (b * testing.B ) {
304
+ q := New [int ]("" )
305
+ defer q .ShutDown ()
306
+ b .ResetTimer ()
307
+ for n := 0 ; n < b .N ; n ++ {
308
+ for i := 0 ; i < 1000 ; i ++ {
309
+ q .Add (i )
310
+ }
311
+ }
312
+ }
313
+
314
+ func BenchmarkAddLockContended (b * testing.B ) {
315
+ q := New [int ]("" )
316
+ defer q .ShutDown ()
317
+ go func () {
318
+ for range 1000 {
319
+ item , _ := q .Get ()
320
+ q .Done (item )
321
+ }
322
+ }()
323
+ b .ResetTimer ()
324
+ for n := 0 ; n < b .N ; n ++ {
325
+ for i := 0 ; i < 1000 ; i ++ {
326
+ q .Add (i )
327
+ }
328
+ }
329
+ }
330
+
303
331
// TestFuzzPrioriorityQueue validates a set of basic
304
332
// invariants that should always be true:
305
333
//
You can’t perform that action at this time.
0 commit comments