File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed
internal/runtime/cgobench Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -796,6 +796,7 @@ var depsRules = `
796
796
FMT < math/big/internal/asmgen;
797
797
798
798
FMT, testing < internal/cgrouptest;
799
+ C, CGO < internal/runtime/cgobench;
799
800
`
800
801
801
802
// listStdPkgs returns the same list of packages as "go list std".
Original file line number Diff line number Diff line change
1
+ // Copyright 2025 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.
4
+
5
+ //go:build cgo
6
+
7
+ package cgobench_test
8
+
9
+ import (
10
+ "internal/runtime/cgobench"
11
+ "testing"
12
+ )
13
+
14
+ func BenchmarkCgoCall (b * testing.B ) {
15
+ for b .Loop () {
16
+ cgobench .Empty ()
17
+ }
18
+ }
19
+
20
+ func BenchmarkCgoCallParallel (b * testing.B ) {
21
+ b .RunParallel (func (pb * testing.PB ) {
22
+ for pb .Next () {
23
+ cgobench .Empty ()
24
+ }
25
+ })
26
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2025 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.
4
+
5
+ //go:build cgo
6
+
7
+ package cgobench
8
+
9
+ /*
10
+ static void empty() {
11
+ }
12
+ */
13
+ import "C"
14
+
15
+ func Empty () {
16
+ C .empty ()
17
+ }
You can’t perform that action at this time.
0 commit comments