From 150de948eeceac0ace02a0f93a9a7a1f7421d744 Mon Sep 17 00:00:00 2001 From: Martin Möhrmann Date: Sat, 10 Sep 2016 22:44:00 +0200 Subject: cmd/compile: intrinsify slicebytetostringtmp when not instrumenting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit when not instrumenting: - Intrinsify uses of slicebytetostringtmp within the runtime package in the ssa backend. - Pass OARRAYBYTESTRTMP nodes to the compiler backends for lowering instead of generating calls to slicebytetostringtmp. name old time/op new time/op delta ConcatStringAndBytes-4 27.9ns ± 2% 24.7ns ± 2% -11.52% (p=0.000 n=43+43) Fixes #17044 Change-Id: I51ce9c3b93284ce526edd0234f094e98580faf2d Reviewed-on: https://go-review.googlesource.com/29017 Run-TryBot: Martin Möhrmann TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- src/runtime/string_test.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/runtime/string_test.go') diff --git a/src/runtime/string_test.go b/src/runtime/string_test.go index 6aab0ed764..4ee32ea671 100644 --- a/src/runtime/string_test.go +++ b/src/runtime/string_test.go @@ -82,6 +82,13 @@ func BenchmarkCompareStringBig(b *testing.B) { b.SetBytes(int64(len(s1))) } +func BenchmarkConcatStringAndBytes(b *testing.B) { + s1 := []byte("Gophers!") + for i := 0; i < b.N; i++ { + _ = "Hello " + string(s1) + } +} + var stringdata = []struct{ name, data string }{ {"ASCII", "01234567890"}, {"Japanese", "日本語日本語日本語"}, -- cgit v1.3-5-g9baa