mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-26 17:46:34 +03:00
Added benchmark for comparing unequal strings with EqualBytesStr
This commit is contained in:
@@ -37,7 +37,7 @@ func BenchmarkLowercaseBytesMixed(b *testing.B) {
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkEqualBytesStr(b *testing.B) {
|
||||
func BenchmarkEqualBytesStrEq(b *testing.B) {
|
||||
s := "foobarbaraz"
|
||||
bs := []byte(s)
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
@@ -49,6 +49,19 @@ func BenchmarkEqualBytesStr(b *testing.B) {
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkEqualBytesStrNe(b *testing.B) {
|
||||
s := "foobarbaraz"
|
||||
bs := []byte(s)
|
||||
bs[len(s)-1] = 'a'
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
for pb.Next() {
|
||||
if EqualBytesStr(bs, s) {
|
||||
b.Fatalf("unexpected result: %q = %q", bs, s)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkAppendBytesStr(b *testing.B) {
|
||||
s := "foobarbazbaraz"
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
|
||||
Reference in New Issue
Block a user