1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
11 func BenchmarkCallClosure(b
*testing
.B
) {
12 for i
:= 0; i
< b
.N
; i
++ {
13 s
+= func(ii
int) int { return 2 * ii
}(i
)
17 func BenchmarkCallClosure1(b
*testing
.B
) {
18 for i
:= 0; i
< b
.N
; i
++ {
20 s
+= func(ii
int) int { return 2*ii
+ j
}(i
)
26 func BenchmarkCallClosure2(b
*testing
.B
) {
27 for i
:= 0; i
< b
.N
; i
++ {
36 func addr1(x
int) *int {
37 return func() *int { return &x
}()
40 func BenchmarkCallClosure3(b
*testing
.B
) {
41 for i
:= 0; i
< b
.N
; i
++ {
46 func addr2() (x
int, p
*int) {
47 return 0, func() *int { return &x
}()
50 func BenchmarkCallClosure4(b
*testing
.B
) {
51 for i
:= 0; i
< b
.N
; i
++ {