
Benchmark a Go JSON API Handler From Request to Response
Benchmark a Go JSON handler end to end: Encoder versus Marshal versus a pooled buffer versus cached bytes, plus what strict decoding costs, with allocations.
Tag
5 articles

Benchmark a Go JSON handler end to end: Encoder versus Marshal versus a pooled buffer versus cached bytes, plus what strict decoding costs, with allocations.

Measure gRPC cost in Go by message size, one connection versus four and gzip on or off, then see which bottlenecks matter more than the transport.

Benchmark a concurrent counter in Go four ways: mutex, atomic, sharded and padded sharded, at 1, 4 and 10 cores, and see why cache lines decide the winner.

Benchmark sync.RWMutex against sync.Mutex across read-write ratios and critical section lengths, and learn when the read lock helps and when it costs more.

Benchmark worker pool sizes in Go for CPU-bound and I/O-bound jobs, see where throughput stops improving, and learn how to size a pool from measurements.