github.com/metacubex/sing-tun@v0.2.7-0.20240512075008-89e7c6208eec/internal/clashtcpip/tcpip_compat_test.go (about)

     1  package clashtcpip
     2  
     3  import (
     4  	"crypto/rand"
     5  	"testing"
     6  )
     7  
     8  const (
     9  	chunkSize  = 9000
    10  	chunkCount = 10
    11  )
    12  
    13  func Benchmark_SumCompat(b *testing.B) {
    14  	bytes := make([]byte, chunkSize)
    15  
    16  	_, err := rand.Reader.Read(bytes)
    17  	if err != nil {
    18  		b.Skipf("Rand read failed: %v", err)
    19  	}
    20  
    21  	b.ResetTimer()
    22  
    23  	for i := 0; i < b.N; i++ {
    24  		SumCompat(bytes)
    25  	}
    26  }