@@ -20,27 +20,27 @@ that help victims of the war in Ukraine: <https://www.stopputin.net/>.
2020Q&A: ask questions on [ StackOverflow with the tag
2121fmt] ( https://stackoverflow.com/questions/tagged/fmt ) .
2222
23- Try {fmt} in [ Compiler Explorer] ( https://godbolt.org/z/Eq5763 ) .
23+ Try {fmt} in [ Compiler Explorer] ( https://godbolt.org/z/8Mx1EW73v ) .
2424
2525# Features
2626
27- - Simple [ format API] ( https://fmt.dev/latest/api.html ) with positional
27+ - Simple [ format API] ( https://fmt.dev/latest/api/ ) with positional
2828 arguments for localization
2929- Implementation of [ C++20
3030 std::format] ( https://en.cppreference.com/w/cpp/utility/format ) and
3131 [ C++23 std::print] ( https://en.cppreference.com/w/cpp/io/print )
32- - [ Format string syntax] ( https://fmt.dev/latest/syntax.html ) similar
32+ - [ Format string syntax] ( https://fmt.dev/latest/syntax/ ) similar
3333 to Python\' s
3434 [ format] ( https://docs.python.org/3/library/stdtypes.html#str.format )
3535- Fast IEEE 754 floating-point formatter with correct rounding,
3636 shortness and round-trip guarantees using the
3737 [ Dragonbox] ( https://github.com/jk-jeon/dragonbox ) algorithm
3838- Portable Unicode support
3939- Safe [ printf
40- implementation] ( https://fmt.dev/latest/api.html #printf-formatting )
40+ implementation] ( https://fmt.dev/latest/api/ #printf-formatting )
4141 including the POSIX extension for positional arguments
4242- Extensibility: [ support for user-defined
43- types] ( https://fmt.dev/latest/api.html #formatting-user-defined-types )
43+ types] ( https://fmt.dev/latest/api/ #formatting-user-defined-types )
4444- High performance: faster than common standard library
4545 implementations of ` (s)printf ` , iostreams, ` to_string ` and
4646 ` to_chars ` , see [ Speed tests] ( #speed-tests ) and [ Converting a
@@ -58,8 +58,8 @@ Try {fmt} in [Compiler Explorer](https://godbolt.org/z/Eq5763).
5858 buffer overflow errors
5959- Ease of use: small self-contained code base, no external
6060 dependencies, permissive MIT
61- [ license] ( https://github.com/fmtlib/fmt/blob/master/LICENSE.rst )
62- - [ Portability] ( https://fmt.dev/latest/index.html #portability ) with
61+ [ license] ( https://github.com/fmtlib/fmt/blob/master/LICENSE )
62+ - [ Portability] ( https://fmt.dev/latest/#portability ) with
6363 consistent output across platforms and support for older compilers
6464- Clean warning-free codebase even on high warning levels such as
6565 ` -Wall -Wextra -pedantic `
@@ -203,43 +203,38 @@ and [ryu](https://github.com/ulfjack/ryu):
203203
204204## Compile time and code bloat
205205
206- The script
207- [ bloat-test.py] ( https://github.com/fmtlib/format-benchmark/blob/master/bloat-test.py )
208- from [ format-benchmark] ( https://github.com/fmtlib/format-benchmark )
209- tests compile time and code bloat for nontrivial projects. It generates
210- 100 translation units and uses ` printf() ` or its alternative five times
211- in each to simulate a medium-sized project. The resulting executable
212- size and compile time (Apple LLVM version 8.1.0 (clang-802.0.42), macOS
213- Sierra, best of three) is shown in the following tables.
206+ The script [ bloat-test.py] [ test ] from [ format-benchmark] [ bench ] tests compile
207+ time and code bloat for nontrivial projects. It generates 100 translation units
208+ and uses ` printf() ` or its alternative five times in each to simulate a
209+ medium-sized project. The resulting executable size and compile time (Apple
210+ clang version 15.0.0 (clang-1500.1.0.2.5), macOS Sonoma, best of three) is shown
211+ in the following tables.
212+
213+ [ test ] : https://github.com/fmtlib/format-benchmark/blob/master/bloat-test.py
214+ [ bench ] : https://github.com/fmtlib/format-benchmark
214215
215216** Optimized build (-O3)**
216217
217218| Method | Compile Time, s | Executable size, KiB | Stripped size, KiB |
218219| ---------------| -----------------| ----------------------| --------------------|
219- | printf | 2.6 | 29 | 26 |
220- | printf+string | 16.4 | 29 | 26 |
221- | iostreams | 31.1 | 59 | 55 |
222- | {fmt} | 19.0 | 37 | 34 |
223- | Boost Format | 91.9 | 226 | 203 |
224- | Folly Format | 115.7 | 101 | 88 |
225-
226- As you can see, {fmt} has 60% less overhead in terms of resulting binary
227- code size compared to iostreams and comes pretty close to ` printf ` .
228- Boost Format and Folly Format have the largest overheads.
220+ | printf | 1.6 | 54 | 50 |
221+ | IOStreams | 25.9 | 98 | 84 |
222+ | fmt 83652df | 4.8 | 54 | 50 |
223+ | tinyformat | 29.1 | 161 | 136 |
224+ | Boost Format | 55.0 | 530 | 317 |
229225
230- ` printf+string ` is the same as ` printf ` but with an extra ` <string> `
231- include to measure the overhead of the latter .
226+ {fmt} is fast to compile and is comparable to ` printf ` in terms of per-call
227+ binary size (within a rounding error on this system) .
232228
233229** Non-optimized build**
234230
235231| Method | Compile Time, s | Executable size, KiB | Stripped size, KiB |
236232| ---------------| -----------------| ----------------------| --------------------|
237- | printf | 2.2 | 33 | 30 |
238- | printf+string | 16.0 | 33 | 30 |
239- | iostreams | 28.3 | 56 | 52 |
240- | {fmt} | 18.2 | 59 | 50 |
241- | Boost Format | 54.1 | 365 | 303 |
242- | Folly Format | 79.9 | 445 | 430 |
233+ | printf | 1.4 | 54 | 50 |
234+ | IOStreams | 23.4 | 92 | 68 |
235+ | {fmt} 83652df | 4.4 | 89 | 85 |
236+ | tinyformat | 24.5 | 204 | 161 |
237+ | Boost Format | 36.4 | 831 | 462 |
243238
244239` libc ` , ` lib(std)c++ ` , and ` libfmt ` are all linked as shared libraries
245240to compare formatting function overhead only. Boost Format is a
@@ -248,7 +243,7 @@ header-only library so it doesn\'t provide any linkage options.
248243## Running the tests
249244
250245Please refer to [ Building the
251- library] ( https://fmt.dev/latest/usage.html #building-the-library ) for
246+ library] ( https://fmt.dev/latest/get-started/ #building-from-source ) for
252247instructions on how to build the library and run the unit tests.
253248
254249Benchmarks reside in a separate repository,
@@ -270,8 +265,7 @@ or the bloat test:
270265
271266# Migrating code
272267
273- [ clang-tidy] ( https://clang.llvm.org/extra/clang-tidy/ ) v17 (not yet
274- released) provides the
268+ [ clang-tidy] ( https://clang.llvm.org/extra/clang-tidy/ ) v18 provides the
275269[ modernize-use-std-print] ( https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-std-print.html )
276270check that is capable of converting occurrences of ` printf ` and
277271` fprintf ` to ` fmt::print ` if configured to do so. (By default it
@@ -303,7 +297,7 @@ converts to `std::print`.)
303297 underwater vehicle
304298- [ Drake] ( https://drake.mit.edu/ ) : a planning, control, and analysis
305299 toolbox for nonlinear dynamical systems (MIT)
306- - [ Envoy] ( https://lyft. github.io/envoy/ ) : C++ L7 proxy and
300+ - [ Envoy] ( https://github.com/envoyproxy/envoy ) : C++ L7 proxy and
307301 communication bus (Lyft)
308302- [ FiveM] ( https://fivem.net/ ) : a modification framework for GTA V
309303- [ fmtlog] ( https://github.com/MengRao/fmtlog ) : a performant
@@ -343,7 +337,7 @@ converts to `std::print`.)
343337- [ Quill] ( https://github.com/odygrd/quill ) : asynchronous low-latency
344338 logging library
345339- [ QKW] ( https://github.com/ravijanjam/qkw ) : generalizing aliasing to
346- simplify navigation, and executing complex multi-line terminal
340+ simplify navigation, and execute complex multi-line terminal
347341 command sequences
348342- [ redis-cerberus] ( https://github.com/HunanTV/redis-cerberus ) : a Redis
349343 cluster proxy
@@ -432,7 +426,7 @@ code bloat issues (see [Benchmarks](#benchmarks)).
432426
433427## FastFormat
434428
435- This is an interesting library that is fast, safe, and has positional
429+ This is an interesting library that is fast, safe and has positional
436430arguments. However, it has significant limitations, citing its author:
437431
438432> Three features that have no hope of being accommodated within the
@@ -442,8 +436,8 @@ arguments. However, it has significant limitations, citing its author:
442436> - Octal/hexadecimal encoding
443437> - Runtime width/alignment specification
444438
445- It is also quite big and has a heavy dependency, STLSoft, which might be
446- too restrictive for using it in some projects.
439+ It is also quite big and has a heavy dependency, on STLSoft, which might be
440+ too restrictive for use in some projects.
447441
448442## Boost Spirit.Karma
449443
@@ -462,7 +456,7 @@ second](http://www.zverovich.net/2020/06/13/fast-int-to-string-revisited.html).
462456
463457# Documentation License
464458
465- The [Format String Syntax](https://fmt.dev/latest/syntax.html ) section
459+ The [Format String Syntax](https://fmt.dev/latest/syntax/ ) section
466460in the documentation is based on the one from Python [string module
467461documentation](https://docs.python.org/3/library/string.html#module-string).
468462For this reason, the documentation is distributed under the Python
@@ -486,5 +480,5 @@ To report a security issue, please disclose it at [security
486480advisory](https://github.com/fmtlib/fmt/security/advisories/new).
487481
488482This project is maintained by a team of volunteers on a
489- reasonable-effort basis. As such, please give us at least 90 days to
483+ reasonable-effort basis. As such, please give us at least *90* days to
490484work on a fix before public exposure.
0 commit comments