We Shipped an Optimization Our Own Benchmark Said Not To
说明与用途
团队为 logq 添加了并行聚合,但在真实数据上导致 16% 的慢速。-j 标志已公开发布并披露问题,同时移除了无法解释的 CI 工作流。
问题
Adding parallelism to a log query tool’s aggregation stage without parallelizing JSON decoding caused a 16% slowdown on real data, yet the feature was shipped.
结果
The team shipped a parallel aggregation flag that was slower on real data, but maintained correctness and transparency. They also removed a problematic CI workflow, improving build reliability.
工作流
- 1. Added -j flag to spawn N goroutines for aggregation.
- 2. Sharded aggregation by hashing group keys to ensure deterministic placement.
- 3. Verified correctness by comparing byte‑identical output between -j 1 and -j 16 on a 2,000‑record fixture.
- 4. Benchmarked on a 76.3 MB file: -j 1 finished in 6.535 s, -j 8 in 7.558 s (16% slower).
- 5. Decided to ship the flag with disclosure of the regression.
- 6. Removed an unexplained CI workflow that failed without clear cause.
- 7. Documented all benchmarks and reproducibility steps in README and make targets.
证据
-j 8 (8 parallel workers) measured 16% slower than -j 1 on a real 76.3MB file — shipped anyway, disclosed the moment it was found
We shipped the flag anyway.
CI landed in that same sweep commit, 58da5cf: matrix build across Linux/macOS/Windows, a coverage gate, -race, fuzzing, a reproducibility check.
- 记录日期: 2026-09-13T20:00:35.940Z