a73x

high effort, low reward

← Posts

Go Benchmarking

Table of Contents

The benchmark cycle:

  1. write a benchmark
  2. run a benchmark
  3. get a profile
  4. optimise
  5. run your tests
  6. goto 2.

cpuprofile

go test -test=XXX -bench <regex> -cpuprofile <file>

memprofile

go test -test=XXX -bench <regex> -memprofile <file> -benchmem

pprof

pprof usage

go pprof -http=:8080 profile.pb.gz

will show a web UI for analysing the profile.

views