Replacing boost::format with fmt
Posted: 28 Oct 2017, 08:24
In looking to de-boost, I stumbled across boost::string(boost::format( that happens quite a bit in our codebase, it does utf8/wide %s string formatting.
Apparently, thanks to benchmarks, it shows that boost is the slowest of the string formatting options. Introducing FMT, a C++11 library that apparently used by many projects for this specific purpose and is super fast.
https://github.com/fmtlib/fmt
I've already tested it here and have it in a branch, but I wanted to know how you guys felt about it? We can either add it to our 3rd party libs that we carry with us, or add as a dependency for packagers.
Benchmarks:
Library Method Run Time, s
EGLIBC 2.19 printf 1.30
libstdc++ 4.8.2 std::ostream 1.85
fmt 1.0 fmt::print 1.42
tinyformat 2.0.1 tfm::printf 2.25
Boost Format 1.54 boost::format 9.94
Apparently, thanks to benchmarks, it shows that boost is the slowest of the string formatting options. Introducing FMT, a C++11 library that apparently used by many projects for this specific purpose and is super fast.
https://github.com/fmtlib/fmt
I've already tested it here and have it in a branch, but I wanted to know how you guys felt about it? We can either add it to our 3rd party libs that we carry with us, or add as a dependency for packagers.
Benchmarks:
Library Method Run Time, s
EGLIBC 2.19 printf 1.30
libstdc++ 4.8.2 std::ostream 1.85
fmt 1.0 fmt::print 1.42
tinyformat 2.0.1 tfm::printf 2.25
Boost Format 1.54 boost::format 9.94