github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/encoding/bigint/bench_test.go (about)

     1  package bigint
     2  
     3  import (
     4  	"math/big"
     5  	"testing"
     6  )
     7  
     8  func BenchmarkToPreallocatedBytes(b *testing.B) {
     9  	v := big.NewInt(100500)
    10  	vn := big.NewInt(-100500)
    11  	buf := make([]byte, 4)
    12  
    13  	for i := 0; i < b.N; i++ {
    14  		_ = ToPreallocatedBytes(v, buf[:0])
    15  		_ = ToPreallocatedBytes(vn, buf[:0])
    16  	}
    17  }