github.com/alphadose/zenq/v2@v2.8.4/benchmarks/simple/main_test.go (about)

     1  package main
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func zenqTestRunner(numWriters uint64, size uint64, b *testing.B) {
     8  	currSize = size
     9  	numConcurrentWriters = numWriters
    10  
    11  	cleanup()
    12  	b.ResetTimer()
    13  	for n := 0; n < b.N; n++ {
    14  		zenqRunner()
    15  	}
    16  }
    17  
    18  func chanTestRunner(numWriters uint64, size uint64, b *testing.B) {
    19  	currSize = size
    20  	numConcurrentWriters = numWriters
    21  
    22  	cleanup()
    23  	b.ResetTimer()
    24  	for n := 0; n < b.N; n++ {
    25  		chanRunner()
    26  	}
    27  }
    28  
    29  func Benchmark_Chan_NumWriters1_InputSize600(b *testing.B) { chanTestRunner(1, 6e2, b) }
    30  
    31  func Benchmark_ZenQ_NumWriters1_InputSize600(b *testing.B) { zenqTestRunner(1, 6e2, b) }
    32  
    33  func Benchmark_Chan_NumWriters3_InputSize60000(b *testing.B) { chanTestRunner(3, 6e4, b) }
    34  
    35  func Benchmark_ZenQ_NumWriters3_InputSize60000(b *testing.B) { zenqTestRunner(3, 6e4, b) }
    36  
    37  func Benchmark_Chan_NumWriters8_InputSize6000000(b *testing.B) { chanTestRunner(8, 6e6, b) }
    38  
    39  func Benchmark_ZenQ_NumWriters8_InputSize6000000(b *testing.B) { zenqTestRunner(8, 6e6, b) }
    40  
    41  func Benchmark_Chan_NumWriters100_InputSize6000000(b *testing.B) { chanTestRunner(100, 6e6, b) }
    42  
    43  func Benchmark_ZenQ_NumWriters100_InputSize6000000(b *testing.B) { zenqTestRunner(100, 6e6, b) }
    44  
    45  func Benchmark_Chan_NumWriters1000_InputSize7000000(b *testing.B) { chanTestRunner(1e3, 7e6, b) }
    46  
    47  func Benchmark_ZenQ_NumWriters1000_InputSize7000000(b *testing.B) { zenqTestRunner(1e3, 7e6, b) }
    48  
    49  func Benchmark_Chan_Million_Blocking_Writers(b *testing.B) { chanTestRunner(1e6, 1e7, b) }
    50  
    51  func Benchmark_ZenQ_Million_Blocking_Writers(b *testing.B) { zenqTestRunner(1e6, 1e7, b) }