Skip to content

Instantly share code, notes, and snippets.

{"schemaVersion":1,"label":"Nix Make","message":"failing","color":"red"}
{"schemaVersion":1,"label":"Windows CMake","message":"cancelled","color":"yellow"}
@aleks-f
aleks-f / intToStr.cpp
Created April 6, 2026 10:52
intToStr bechmark
///
/// bench_inttostr.cpp
///
/// Micro-benchmark comparing the old (manual digit extraction + reverse)
/// intToStr implementation vs. the new (std::to_chars + formatInt) version.
///
/// Build:
/// g++ -std=c++20 -O2 -DNDEBUG -o bench_inttostr bench_inttostr.cpp
/// (add -march=native for best results on your machine)
///
@aleks-f
aleks-f / intToStrOpt.cpp
Created April 6, 2026 11:16
inToStrOpt
///
/// bench_inttostr.cpp
///
/// Micro-benchmark comparing three intToStr implementations:
/// OLD - original Poco (manual digit loop + reverse)
/// NEW - std::to_chars + non-template formatInt
/// OPT - improved old: two-digits-at-a-time for base 10,
/// raw pointers, unsigned T_MIN handling, same API
///
/// Build: