go-profiler-notes/examples/callers-func-length
gh-worker-campaigns-3e9aa4[bot] 5636202275
Executing automated changes
2026-04-23 10:01:20 +00:00
..
go.mod Executing automated changes 2026-04-23 10:01:20 +00:00
main.go callers-func-length 2021-04-03 12:47:19 +02:00
main_test.go callers-func-length 2021-04-03 12:47:19 +02:00
README.md callers-func-length 2021-04-03 12:47:19 +02:00

callers-func-length

A simple benchmark that shows that the costs of stack unwinding in Go increase for larger functions. This is due to the way gopclntab based unwinding is implemented.

go test -bench .
goos: darwin
goarch: amd64
pkg: github.com/felixge/go-profiler-notes/examples/callers-func-length
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkCallers/short-12         	2623002	      454.1 ns/op
BenchmarkCallers/loop-12          	2590384	      466.8 ns/op
BenchmarkCallers/long-12          	 638096	     1862 ns/op