Per call
Measured with the repository's bench/ (gcc 11, -O2, one million calls):
| Call | ns / call |
|---|---|
hand-written appends to a std::string (baseline) | 71 |
PlainStr( ) — a constant text | 40 |
SingleStr( user, n ) — two parameters | 94 |
SingleStr( user, n, loc ) | 84 |
FiveStr( user, n ) — five languages | 134 |
mstring 1.1 built every string through a std::ostringstream: 418 ns for the two-parameter message, 337 ns for the constant. Since 1.2 the text is appended to the string directly, values go through std::to_chars where that gives the same result, and only formatted values use a stream. See Text functions.
Run it yourself:
cmake --preset conan-release -DBENCH=ON
cmake --build --preset conan-release --target mstring-bench
build/Release/bench/mstring-bench
Several languages
Every language adds a string comparison of the locale name, about 10 ns each. For hot paths with many languages, pass a locale whose name matches early, or keep one module per audience.
Header-only: INLINE
$MODULE texts INLINE
Everything goes into texts.hh as inline definitions: nothing to add to the build but the header, and the compiler can inline a string function into its caller. Several INLINE modules — and ordinary ones — mix in one translation unit. The price is compile time in every file that includes it, so keep INLINE for small modules. See INLINE modules and the walkthrough.

