github.com/jnwhiteh/go-luapatterns@v0.0.0-20131030164548-272320f1591f/luapatterns/benchmark_test.go (about)

     1  package luapatterns
     2  
     3  import "testing"
     4  import "strings"
     5  
     6  var limit int = 1e6
     7  var longBytes = make([]byte, limit+1, limit+1)
     8  var longString = strings.Repeat("a", limit) + "b"
     9  
    10  func BenchmarkLongBytes(b *testing.B) {
    11  	for i := 0; i < limit; i++ {
    12  		longBytes[i] = 'a'
    13  	}
    14  	longBytes[limit] = 'b'
    15  	_, _, _, _ = FindBytes(longBytes, []byte(".-b"), false)
    16  }
    17  
    18  func BenchmarkLongString(b *testing.B) {
    19  	_, _, _, _ = Find(longString, ".-b", false)
    20  }