Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

HaloLog: A Go Logger with 23.9 ns/op Claim and Fairness Testing

Описание и применение

HaloLog – это структурированный логгер для Go, который утверждает 23,9 нс/операцию. Автор добавил строгий контракт вывода и тесты на точность, чтобы сделать утверждение воспроизводимым и проверяемым.

Задача

High‑performance telemetry claims must be reproducible, falsifiable, and include a full output contract.

Результат

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.

Рабочий процесс

  • 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).

Доказательства

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.

Источник

  • Дата записи: 2026-09-07T00:53:12.042Z