Understanding benchmarking
Metrics and measurement are at the root of optimization. The adage You can't improve what you can't measure rings true with performance. To be able to make intelligent decisions about performance optimizations, we must continuously measure the performance of the functions we are trying to optimize.
As we mentioned in Chapter 1, Introduction to Performance in Go, the Go creators made performance a forethought in their language design. The Go testing package (https://golang.org/pkg/testing/) is used to test Go code in a systematic way. The testing package is a fundamental part of the Go language. This package also includes a helpful built-in benchmarking functionality. This functionality, which is invoked by go test ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access