liveBook · Manning

Mean

As explained in 100 Go Mistakes and How to Avoid Them

Execution time is the elapsed duration required for a computation or operation to complete.

A mean execution time summarizes how long an operation takes on average. In Go benchmarks, it is reported as time per operation; treat it as a measurement for a particular workload, Go version, and machine, not a universal guarantee. section 11.8 section 11.8.2

Avoid drawing conclusions from one mean alone:

  • Run benchmarks repeatedly and compare their variation; two means near 5.10 ns/op with ±1% variation support a more cautious comparison than a single run. section 11.8.2
  • Match measurements to the system that will run the application; a microbenchmark result from one machine may not carry over to another. section 11.8.2
$ benchstat stats.txt
name                time/op
AtomicStoreInt32-4  5.10ns ± 1%
AtomicStoreInt64-4  5.10ns ± 1%

Repeated benchmark results show similar mean times and their variation. section 11.8.2

How 100 Go Mistakes and How to Avoid Them covers it

How deep it goes
Reports per-operation averages and qualifies them with repeated-run variation, but does not derive the mean mathematically.
Examples
Uses Go benchmark timings and repeated atomic-store microbenchmarks to illustrate mean comparisons.
What it assumes
Assumes familiarity with Go benchmark results and their iterations; briefly reviews how benchmark iteration counts are adjusted.
What you can do after
Evaluate benchmark comparisons by repeating runs, checking variation, and accounting for the tested machine and Go version.
How it connects
Ties mean execution time to Go benchmarks, microbenchmarks, garbage collection, and latency.

Also explained in

Compare how 29 books explain mean →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of 100 Go Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.