Skip to content

Proposal: vendor stb_sprintf for locale-independent, deterministic formatting #571

Description

@somethingwithproof

Implementation evidence — 2026-10-11

ADR 0004 retains libc formatting. The implemented benchmark job and two checked-in 20-pair measurements provide a reproducible comparison path, but neither substitutes stb_sprintf or isolates formatting cost. No formatter improvement has been demonstrated; no new dependency is justified by these measurements. Keep any future adoption conditional on the profiling and compatibility criteria below.

Implementation and validation: #656

Checked-in measurements and acceptance documentation: #658

Benchmarks and remaining acceptance boundaries are checked in with the PR. Reported measurements do not demonstrate a speedup.

Decision status

Defer adopting or vendoring stb_sprintf until profiling demonstrates a material formatting bottleneck. No benchmark evidence in this proposal currently justifies replacing the system formatter.

Evidence required before implementation

  • Profile a representative disposable poll cycle and quantify time spent formatting relative to SNMP, scripts, and database operations.
  • Publish a reproducible benchmark with realistic formats, values, compiler options, and supported platforms.
  • Demonstrate an operator-relevant improvement and account for compatibility and maintenance costs.
  • Audit relied-on formatting behavior, including positional arguments, NULL handling, floating-point output, truncation, and error returns.
  • If justified, propose a narrow measured integration with a documented fallback, rather than replacing all call sites.

Existing vendored uthash is still included but has no production HASH_* consumers in the audited tree. Resolve dependency policy explicitly before adding another vendored library; do not expand this formatting proposal into an unrelated hash-table migration.

If profiling finds no material benefit, close this proposal rather than adding a dependency without a demonstrated need.

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions