mirror of https://github.com/golang/go.git
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>
|
||
|---|---|---|
| .. | ||
| testdata | ||
| backdoor.go | ||
| buildid_linux.go | ||
| callback.go | ||
| callback_c.c | ||
| callback_c_gc.c | ||
| callback_c_gccgo.c | ||
| cgo_linux_test.go | ||
| cgo_stubs_android_test.go | ||
| cgo_test.go | ||
| cgo_thread_lock.go | ||
| cgo_unix_test.go | ||
| cthread_unix.c | ||
| cthread_windows.c | ||
| issue4029.c | ||
| issue4029.go | ||
| issue4029w.go | ||
| issue4273.c | ||
| issue4273b.c | ||
| issue4339.c | ||
| issue4339.h | ||
| issue5548_c.c | ||
| issue5740a.c | ||
| issue5740b.c | ||
| issue6833_c.c | ||
| issue6907export_c.c | ||
| issue6997_linux.c | ||
| issue6997_linux.go | ||
| issue7234_test.go | ||
| issue8148.go | ||
| issue8331.h | ||
| issue8517.go | ||
| issue8517_windows.c | ||
| issue8517_windows.go | ||
| issue8694.go | ||
| issue8811.c | ||
| issue8945.go | ||
| issue18146.go | ||
| issue20910.c | ||
| issue21897.go | ||
| issue21897b.go | ||
| overlaydir_test.go | ||
| pkg_test.go | ||
| setgid_linux.go | ||
| sigaltstack.go | ||
| sigprocmask.c | ||
| sigprocmask.go | ||
| test.go | ||
| test_unix.go | ||
| test_windows.go | ||
| testx.go | ||