Tags: #go #performance
Reference: https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go
Running benchmarks requires the -bench
flag to be given a valid regex pattern:
go test -v -bench=.
Note: this will still run all the tests (as you’re using the
go test
subcommand).
Run benchmarks but disable tests from being run:
go test -v -bench=. -run=XXX
Note: we’ve disabled the tests by passing a valid regex pattern to the
-run
flag, which will not match any known tests.