Skip to content

Instantly share code, notes, and snippets.

@sayden
Last active August 20, 2018 10:34
Show Gist options
  • Save sayden/7205aa08e615c137f9c09aaccdb767bb to your computer and use it in GitHub Desktop.
Save sayden/7205aa08e615c137f9c09aaccdb767bb to your computer and use it in GitHub Desktop.
go test -run=. -bench=Benchmark -benchmem
goos: linux
goarch: amd64
pkg: github.com/sayden/go-research/returning_values
Big/return_by_value-8 100 11740818 ns/op 50834966 B/op 1 allocs/op
Big/return_by_named_value-8 200 8701993 ns/op 50583306 B/op 1 allocs/op
Big/return_pointer-8 300 4188061 ns/op 50331648 B/op 1 allocs/op
Big/return_named_pointer-8 1000 3172411 ns/op 50331653 B/op 1 allocs/op
Small/return_named_pointer-8 10000000 132 ns/op 512 B/op 1 allocs/op
Small/return_pointer-8 10000000 130 ns/op 512 B/op 1 allocs/op
Small/return_by_named_value-8 30000000 37.6 ns/op 0 B/op 0 allocs/op
Small/return_by_value-8 30000000 37.3 ns/op 0 B/op 0 allocs/op
Zendesk/return_pointer-8 20000000 103 ns/op 480 B/op 1 allocs/op
Zendesk/return_by_named_pointer-8 20000000 103 ns/op 480 B/op 1 allocs/op
Zendesk/return_by_value-8 50000000 33.0 ns/op 0 B/op 0 allocs/op
Zendesk/return_by_named_value-8 100000000 20.3 ns/op 0 B/op 0 allocs/op
PASS
ok github.com/sayden/go-research/returning_values 22.290s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment