OpenRTB 2.6 bid request parsing benchmarks in Go — profiling encoding/json with pprof and comparing three JSON implementations.
Companion source for the blog post: Go JSON Performance in Adtech: Profiling OpenRTB Bid Request Parsing
Benchmark suite:
go test -bench=. -benchmem -count=5 ./openrtb/CPU profile (stdlib):
go run ./cmd/profile
go tool pprof -top cpu.profCPU profile (goccy/go-json):
go run ./cmd/profile -impl gojson
go tool pprof -top cpu.profrtbench/
├── openrtb/
│ ├── types.go # OpenRTB 2.6 struct definitions
│ ├── parse.go # Parse() — encoding/json wrapper
│ ├── parse_test.go # correctness tests (table-driven)
│ └── parse_bench_test.go # benchmark suite
├── cmd/
│ └── profile/
│ └── main.go # pprof CPU profiler (200k iterations)
└── testdata/
├── valid_banner.json
└── valid_video.json