Source file src/internal/runtime/cgobench/bench_test.go

     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  }
    27  

View as plain text