Skip to content

LoggerJS 基准矩阵

最后更新:2026-06-18(两台机器的 rows 手工合并;每台机器的 JSON artifacts 位于 gitignored benchmarks/matrix/,所以 aggregate command 不能重新生成本地不存在 artifact 的 row)。

这张表是签入仓库的 loggerjs-vs-pino Node hot-path 声明证据矩阵。Ratios 来自 interleaved A/B harness 的 paired per-round latency medians,不是一轮顺序运行的 ratio。低于 1.00x 表示该机器上 LoggerJS path latency 低于 pino。**下面两行有意不一致,这正是重点:**排序依赖 CPU/V8(M1 Max 上 LoggerJS 更快,M4 Pro 上 pino 更快),因此不能支持普遍“快于 pino”的声明。

LabelPlatformCPUNodeGitRunsPino nsLean nsPrepared nsLean / pinoPrepared / pinoResult
macbookpro-node22darwin/arm64Apple M1 Maxv22.21.15d7e4e3bf42352862442230.843x (118.6%)0.773x (129.3%)LoggerJS lean + prepared faster
m4pro-node22darwin/arm64Apple M4 Prov22.22.21d3d51c21f8661972232111.137x (87.9%)1.054x (94.9%)pino faster (lean + prepared)

Row Details

LabelMemoryDependenciesSamplingBaseline spreadPrepared / lean
macbookpro-node2264 GBpino 10.3.1, winston 3.19.0, LogTape 2.1.35 runs, 120 rounds x 5000 ops, 100000 warmup21.2%0.919x (108.8%)
m4pro-node2224 GBpino 10.3.1, winston 3.19.0, LogTape 2.1.56 runs, 120 rounds x 5000 ops, 100000 warmup41.9%0.942x (106.1%)

Evidence Coverage

RequirementStatusRows
At least one non-Apple-Silicon runtimeMissingdarwin/arm64
At least two Node major versionsMissing22

两个 gate 仍然 Missing:M4 Pro row 是 Node 22 上的第二台 Apple-Silicon CPU,不满足 non-Apple 或 second-Node-major 要求。不过它已经把 universal-claim guard 具体化:在同一 OS/arch/Node-major 内,只替换 CPU(M1 Max -> M4 Pro)就能把结果从“LoggerJS faster”翻转为“pino faster”。在加入 non-Apple 和 second Node-major row 前,性能措辞必须限定到 CPU 范围,不要写成“LoggerJS 总是快于 pino”。

复现

bash
pnpm build
pnpm bench:matrix -- --runs=5 --rounds=120 --label="$(hostname)-node22"

# after copying artifacts from other machines into benchmarks/matrix/
pnpm bench:matrix:aggregate -- benchmarks/matrix --out docs/BENCHMARK-MATRIX.md

非 Apple-Silicon 和多 Node 证据运行手动 GitHub Actions workflow:

bash
gh workflow run benchmark-matrix.yml -f runs=5 -f rounds=120 -f batch=5000 -f warmup=100000

下载 benchmark-matrix-aggregate artifact,review 生成的 benchmark-matrix-ci.md,并且只有当 rows 来自预期 machine/runtime combinations 时才提交到本文件。不要在没有匹配 JSON artifacts 的情况下手写 benchmark rows。

说明:

  • 矩阵只证明列出的 machine/runtime/dependency combinations。不要把它扩展成普遍“always faster than pino”。
  • 测试新 CPUs、操作系统、Node/V8 versions 或 pino releases 时新增 rows。
  • 如果 row 来自 dirty worktree,在 Git 列中标记 *

相关链接

基于 MIT License 发布。