]> Cypherpunks repositories - gostls13.git/commit
cmd/cgo/internal/test: benchmark for #cgo noescape directive
authordoujiang24 <doujiang24@gmail.com>
Sat, 26 Aug 2023 04:49:53 +0000 (04:49 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 28 Aug 2023 16:36:29 +0000 (16:36 +0000)
commit55db1750abdf3a968a7a3a08130e0878ba8939d5
tree16738606ade47336d14634a38cb9d74696d55fb6
parentfaf564644d9948e001db7c4f61a0ac9a61283003
cmd/cgo/internal/test: benchmark for #cgo noescape directive

case: passing a single Go string object to C function.
result: 87 ns vs 61 ns.

BenchmarkCgoCall/string-pointer-escape
BenchmarkCgoCall/string-pointer-escape-12        67731663   87.02 ns/op
BenchmarkCgoCall/string-pointer-noescape
BenchmarkCgoCall/string-pointer-noescape-12    99424776   61.30 ns/op

For #56378

Change-Id: Iff5c69d8deedfa248f5d7399e1921a5cb0dc8b16
GitHub-Last-Rev: fc67d5ad7a1ba56025f2c142bb88cc4174fa3a27
GitHub-Pull-Request: golang/go#62297
Reviewed-on: https://go-review.googlesource.com/c/go/+/522939
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/cmd/cgo/internal/test/test.go