Run all benchmarks

$ go test -bench=.
goos: linux
goarch: amd64
pkg: github.com/ayoisaiah/random
cpu: Intel(R) Core(TM) i7-7560U CPU @ 2.40GHz
BenchmarkPrimeNumbers-4            14588             82798 ns/op
PASS
ok      github.com/ayoisaiah/random     2.091s

Skip unit tests - -run specific which unit tests to execute, using ^# filters out all unit tests

$ go test -bench=. -count 5 -run=^#
-benchtime=10s - run for 10s
-benchmem - include memory alloc

Links

  1. https://blog.logrocket.com/benchmarking-golang-improve-function-performance/#:~:text=A benchmark is a type,the code's overall performance level.