Back to course

Go Benchmarks: Measuring Code Speed

Go (Golang) for Cloud-Native Microservices

Writing Benchmarks

How fast is your JSON parser? Write a benchmark to find out.

go func BenchmarkParse(b *testing.B) { for i := 0; i < b.N; i++ { Parse(data) } }

Run with go test -bench=.. Go will run the loop N times to get a statistically significant result.