summaryrefslogtreecommitdiff
path: root/libgo/go/runtime/string_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/runtime/string_test.go')
-rw-r--r--libgo/go/runtime/string_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/libgo/go/runtime/string_test.go b/libgo/go/runtime/string_test.go
index ee306999e2e..555a7fc7ef9 100644
--- a/libgo/go/runtime/string_test.go
+++ b/libgo/go/runtime/string_test.go
@@ -6,6 +6,7 @@ package runtime_test
import (
"runtime"
+ "strconv"
"strings"
"testing"
)
@@ -89,6 +90,20 @@ func BenchmarkConcatStringAndBytes(b *testing.B) {
}
}
+var escapeString string
+
+func BenchmarkSliceByteToString(b *testing.B) {
+ buf := []byte{'!'}
+ for n := 0; n < 8; n++ {
+ b.Run(strconv.Itoa(len(buf)), func(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ escapeString = string(buf)
+ }
+ })
+ buf = append(buf, buf...)
+ }
+}
+
var stringdata = []struct{ name, data string }{
{"ASCII", "01234567890"},
{"Japanese", "日本語日本語日本語"},