HaloLog: A Go Logger with 23.9 ns/op Claim and Fairness Testing
Description and use
HaloLog is a Go structured logger claiming 23.9 ns/op. The author added a strict output contract and precision tests to make the claim reproducible and falsifiable.
Problem
High‑performance telemetry claims must be reproducible, falsifiable, and include a full output contract.
Outcome
The updated benchmark harness now includes explicit work unit definition, output contract verification, and separate reporting for different Zap configurations, making the 23.9 ns/op claim reproducible and falsifiable.
Workflow
- Define the operation: emit one newline‑terminated JSON record with timestamp, level, message, and dynamic fields to io.Discard.
- Set up logger constructors and dynamic fields outside the timed loop.
- Run the timed loop for each logger, measuring encode+dispatch time.
- Add a semantic contract test: verify one record, JSON validity, required fields, and field types.
- Add a byte‑level test with a fixed clock and golden records to detect timestamp representation differences.
- Report two Zap configurations separately to avoid silent substitution.
- Publish the updated benchmark suite with the same sample count on Linux and Windows.
- Document the findings and limitations (e.g., clock freshness, concurrency).
Evidence
The benchmark writes to io.Discard; it does not measure disk, network, batching, backpressure, or a production log collector.
The first new test exercises the same constructors as the benchmark. For each logger it captures a representative one‑field operation and verifies: exactly one newline‑terminated record was emitted; the record is valid JSON; timestamp and level are present; the expected message is present; the field value is a JSON number, not an accidentally quoted string.
- Record date: 2026-09-07T00:53:12.042Z