github.com/nsqio/nsq@v1.3.0/internal/protocol/byte_base10_test.go (about)

     1  package protocol
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  var result uint64
     8  
     9  func BenchmarkByteToBase10Valid(b *testing.B) {
    10  	bt := []byte{'3', '1', '4', '1', '5', '9', '2', '5'}
    11  	var n uint64
    12  	for i := 0; i < b.N; i++ {
    13  		n, _ = ByteToBase10(bt)
    14  	}
    15  	result = n
    16  }
    17  
    18  func BenchmarkByteToBase10Invalid(b *testing.B) {
    19  	bt := []byte{'?', '1', '4', '1', '5', '9', '2', '5'}
    20  	var n uint64
    21  	for i := 0; i < b.N; i++ {
    22  		n, _ = ByteToBase10(bt)
    23  	}
    24  	result = n
    25  }