Commit 3ee391cc authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

runtime: add Benchmark[Clear|Copy]Fat[16|24]

These benchmarks are important for performance. When compiling the stdlib:

* 77.1% of the calls to sgen (copyfat) are for 16 bytes; another 8.7% are for 24 bytes. (The next most common is 32 bytes, at 5.7%.)
* Over half the calls to clearfat are for 16 or 24 bytes.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews
https://golang.org/cl/111350043
parent e45c384b
......@@ -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 BenchmarkClearFat16(b *testing.B) {
for i := 0; i < b.N; i++ {
var x [16]byte
_ = x
}
}
func BenchmarkClearFat24(b *testing.B) {
for i := 0; i < b.N; i++ {
var x [24]byte
_ = x
}
}
func BenchmarkClearFat32(b *testing.B) {
for i := 0; i < b.N; i++ {
var x [32]byte
......@@ -199,6 +211,20 @@ func BenchmarkClearFat1024(b *testing.B) {
}
}
func BenchmarkCopyFat16(b *testing.B) {
var x [16 / 4]uint32
for i := 0; i < b.N; i++ {
y := x
_ = y
}
}
func BenchmarkCopyFat24(b *testing.B) {
var x [24 / 4]uint32
for i := 0; i < b.N; i++ {
y := x
_ = y
}
}
func BenchmarkCopyFat32(b *testing.B) {
var x [32 / 4]uint32
for i := 0; i < b.N; i++ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment