summaryrefslogtreecommitdiff
path: root/posts/001.md
diff options
context:
space:
mode:
Diffstat (limited to 'posts/001.md')
-rw-r--r--posts/001.md9
1 files changed, 4 insertions, 5 deletions
diff --git a/posts/001.md b/posts/001.md
index 9942c2f..71ece5b 100644
--- a/posts/001.md
+++ b/posts/001.md
@@ -1,26 +1,25 @@
---
title: "Go Benchmarking"
---
-## Benchmarking
1. write a benchmark
2. run a benchmark
3. get a profile
4. optimise
5. run your tests
6. goto 2.
-### cpuprofile
+## cpuprofile
`go test -test=XXX -bench <regex> -cpuprofile <file>`
-### memprofile
+## memprofile
`go test -test=XXX -bench <regex> -memprofile <file> -benchmem`
-### pprof
+## pprof
[pprof usage](https://github.com/google/pprof/blob/main/doc/README.md)
`go pprof -http=:8080 profile.pb.gz`
will show a web UI for analysing the profile.
-#### views:
+### views:
- flame graph: `localhost:8080/ui/flamegraph`
- shows percentage breakdown of how much resource each "call" made.
- clicking a box will make it "100%" allowing for deep diving