1
0
mirror of https://github.com/golang/go synced 2024-11-06 01:36:10 -07:00
go/misc/cgo/test
Egon Elbre e85ffec784 cmd/cgo: optimize cgoCheckPointer call
Currently cgoCheckPointer is only used with one optional argument.
Using a slice for the optional arguments is quite expensive, hence
replace it with a single interface{}. This results in ~30% improvement.

When checking struct fields, they quite often end up being without
pointers. Check this before calling cgoCheckPointer, which results in
additional ~20% improvement.

Inline some p == nil checks from cgoIsGoPointer which gives
additional ~15% improvement.

All of this translates to:

name                             old time/op  new time/op  delta
CgoCall/add-int-32               46.9ns ± 1%  46.6ns ± 1%   -0.75%  (p=0.000 n=18+20)
CgoCall/one-pointer-32            143ns ± 1%    87ns ± 1%  -38.96%  (p=0.000 n=20+20)
CgoCall/eight-pointers-32         767ns ± 0%   327ns ± 1%  -57.30%  (p=0.000 n=18+16)
CgoCall/eight-pointers-nil-32     110ns ± 1%    89ns ± 2%  -19.10%  (p=0.000 n=19+19)
CgoCall/eight-pointers-array-32  5.09µs ± 1%  3.56µs ± 2%  -30.09%  (p=0.000 n=19+19)
CgoCall/eight-pointers-slice-32  3.92µs ± 0%  2.57µs ± 2%  -34.48%  (p=0.000 n=20+20)

Change-Id: I2aa9f5ae8962a9a41a7fb1db0c300893109d0d75
Reviewed-on: https://go-review.googlesource.com/c/go/+/198081
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-02 20:51:29 +00:00
..
testdata cmd/link: permit duplicate weak symbols 2019-03-29 17:46:01 +00:00
backdoor.go
buildid_linux.go misc/cgo/test: avoid endless loop when we can't parse notes 2018-01-11 19:55:49 +00:00
callback_c_gc.c
callback_c_gccgo.c
callback_c.c
callback.go cmd/compile: use existing instructions instead of nops for inline marks 2019-03-25 16:49:29 +00:00
cgo_linux_test.go misc/cgo/test: skip Setgid test on Android 2019-04-08 05:56:14 +00:00
cgo_stubs_android_test.go misc/cgo/test: consolidate tests into fewer cgo source files 2019-05-22 12:52:33 +00:00
cgo_test.go misc, runtime, test: extra tests and benchmarks for defer 2019-09-25 23:27:16 +00:00
cgo_thread_lock.go
cgo_unix_test.go
cthread_unix.c cmd/dist, misc/cgo: enable tests for aix/ppc64 2019-03-20 14:38:44 +00:00
cthread_windows.c
issue4029.c cmd/cgo: permit missing dynamic symbol section 2018-07-02 17:50:00 +00:00
issue4029.go cmd/cgo: permit missing dynamic symbol section 2018-07-02 17:50:00 +00:00
issue4029w.go cmd/cgo: permit missing dynamic symbol section 2018-07-02 17:50:00 +00:00
issue4273.c
issue4273b.c
issue4339.c
issue4339.h
issue5548_c.c
issue5740a.c
issue5740b.c
issue6833_c.c
issue6907export_c.c cmd/cgo: permit passing string values directly between Go and C 2017-11-15 03:36:54 +00:00
issue6997_linux.c
issue6997_linux.go
issue7234_test.go
issue8148.go
issue8331.h
issue8517_windows.c
issue8517_windows.go
issue8517.go
issue8694.go
issue8811.c
issue8945.go
issue18146.go misc/cgo/test: consolidate tests into fewer cgo source files 2019-05-22 12:52:33 +00:00
issue20910.c cmd/cgo: unify cgo output for gc and gccgo 2017-08-16 21:57:56 +00:00
issue21897.go misc/cgo/test: disable some Darwin tests in cgo mode 2018-07-23 15:16:01 +00:00
issue21897b.go misc/cgo/test: disable some Darwin tests in cgo mode 2018-07-23 15:16:01 +00:00
overlaydir_test.go misc/cgo/test: fix tests in module mode 2019-02-24 00:35:18 +00:00
pkg_test.go misc/cgo/test: set PWD when executing 'go test' in an alternate GOPATH 2019-03-01 18:35:31 +00:00
setgid_linux.go
sigaltstack.go all: add new GOOS=illumos, split out of GOOS=solaris 2019-04-30 16:59:13 +00:00
sigprocmask.c misc/cgo/test: add retry loop around pthread_create in TestSigprocmask 2018-06-27 04:33:10 +00:00
sigprocmask.go misc/cgo/test: log error value in testSigprocmask 2018-04-25 20:26:39 +00:00
test_unix.go misc/cgo/test: consolidate tests into fewer cgo source files 2019-05-22 12:52:33 +00:00
test_windows.go misc/cgo/test: consolidate tests into fewer cgo source files 2019-05-22 12:52:33 +00:00
test.go cmd/cgo: optimize cgoCheckPointer call 2019-10-02 20:51:29 +00:00
testx.go misc/cgo/test: use __atomic intrinsics instead of __sync 2019-09-06 17:38:58 +00:00