Skip to content

Instantly share code, notes, and snippets.

View pgmcgee's full-sized avatar

Parker McGee pgmcgee

View GitHub Profile
@pgmcgee
pgmcgee / compilation
Last active December 25, 2017 12:12
Benchmarking list push vs slice append in Go. Slice append is much, much faster for a basic example.
-*- mode: compilation; default-directory: "~/go/src/github.com/pgmcgee/montanus/hack/" -*-
Compilation started at Mon Dec 25 07:08:58
go test -bench=. -benchmem
goos: darwin
goarch: amd64
pkg: github.com/pgmcgee/montanus/hack
BenchmarkList-4 10000000 207 ns/op 56 B/op 2 allocs/op
BenchmarkSlice-4 100000000 17.4 ns/op 8 B/op 1 allocs/op
BenchmarkPreallocatedSlice-4 2000000000 0.74 ns/op 0 B/op 0 allocs/op