From: Josh Bleecher Snyder Date: Mon, 21 Jul 2014 18:23:29 +0000 (-0700) Subject: runtime: add Benchmark[Clear|Copy]Fat[8|12] X-Git-Tag: go1.4beta1~1044 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2ac289c4a095e3133b375ae65c115ff23327a1c4;p=gostls13.git runtime: add Benchmark[Clear|Copy]Fat[8|12] These correspond to 2 and 3 word fat copies/clears on 8g, which dominate usage in the stdlib. (70% of copies and 46% of clears are for 2 or 3 words.) I missed these in CL 111350043, which added 2 and 3 word benchmarks for 6g. A follow-up CL will optimize these cases. LGTM=khr R=khr CC=golang-codereviews https://golang.org/cl/115160043 --- diff --git a/src/pkg/runtime/memmove_test.go b/src/pkg/runtime/memmove_test.go index 8dea1f9e7a..ffda4fe6c5 100644 --- a/src/pkg/runtime/memmove_test.go +++ b/src/pkg/runtime/memmove_test.go @@ -162,6 +162,18 @@ func BenchmarkMemclr256(b *testing.B) { bmMemclr(b, 256) } func BenchmarkMemclr4096(b *testing.B) { bmMemclr(b, 4096) } func BenchmarkMemclr65536(b *testing.B) { bmMemclr(b, 65536) } +func BenchmarkClearFat8(b *testing.B) { + for i := 0; i < b.N; i++ { + var x [8 / 4]uint32 + _ = x + } +} +func BenchmarkClearFat12(b *testing.B) { + for i := 0; i < b.N; i++ { + var x [12 / 4]uint32 + _ = x + } +} func BenchmarkClearFat16(b *testing.B) { for i := 0; i < b.N; i++ { var x [16 / 4]uint32 @@ -211,6 +223,20 @@ func BenchmarkClearFat1024(b *testing.B) { } } +func BenchmarkCopyFat8(b *testing.B) { + var x [8 / 4]uint32 + for i := 0; i < b.N; i++ { + y := x + _ = y + } +} +func BenchmarkCopyFat12(b *testing.B) { + var x [12 / 4]uint32 + for i := 0; i < b.N; i++ { + y := x + _ = y + } +} func BenchmarkCopyFat16(b *testing.B) { var x [16 / 4]uint32 for i := 0; i < b.N; i++ {