117TEST_CASE(
"jau_cfmt_benchmark_append_integral00",
"[benchmark][jau][std::string][format_string]") {
118 const size_t loops = 1000;
119 WARN(
"Benchmark with " + std::to_string(
loops) +
" loops");
122 const uint64_t i1 = std::numeric_limits<uint64_t>::max();
123 static constexpr const char *format_check_exp =
"18446744073709551615";
128 std::cout <<
"flags: " << o1 <<
"\n";
134 jau::cfmt::impl::append_integral(s, s.max_size(), i1,
false, o1,
false);
135 REQUIRE(format_check_exp == s);
138 jau::cfmt::impl::append_integral_simple(s, s.max_size(), i1,
false, o1);
139 REQUIRE(format_check_exp == s);
142 BENCHMARK(
"append_integral rsrved bench") {
143 volatile size_t res = 0;
144 for(
size_t i = 0; i <
loops; ++i ) {
148 jau::cfmt::impl::append_integral(s, s.max_size(), i1,
false, o1,
false);
149 REQUIRE(format_check_exp == s);
150 res = res + s.size();
154 BENCHMARK(
"append_integral_simple rsrved bench") {
155 volatile size_t res = 0;
156 for(
size_t i = 0; i <
loops; ++i ) {
160 jau::cfmt::impl::append_integral_simple(s, s.max_size(), i1,
false, o1);
161 REQUIRE(format_check_exp == s);
162 res = res + s.size();
167 BENCHMARK(
"snprintf rsrved bench") {
168 volatile size_t res = 0;
169 for(
size_t i = 0; i <
loops; ++i ) {
174 size_t nchars = std::snprintf(&s[0], bsz,
"%zu", i1);
178 REQUIRE(format_check_exp == s);
185TEST_CASE(
"jau_cfmt_benchmark_append_integral01",
"[benchmark][jau][std::string][format_string]") {
186 const size_t loops = 1000;
187 WARN(
"Benchmark with " + std::to_string(
loops) +
" loops");
190 const uint64_t i1 = std::numeric_limits<uint64_t>::max();
191 static constexpr const char *format_check_exp1 =
" 018446744073709551615";
192 static constexpr const char *format_check_exp0 =
" 018446744073709551615";
198 std::cout <<
"flags: " << o1 <<
"\n";
204 jau::cfmt::impl::append_integral(s, s.max_size(), i1,
false, o1,
false);
205 REQUIRE(format_check_exp1 == s);
208 BENCHMARK(
"append_integral rsrved bench") {
209 volatile size_t res = 0;
210 for(
size_t i = 0; i <
loops; ++i ) {
214 jau::cfmt::impl::append_integral(s, s.max_size(), i1,
false, o1,
false);
215 REQUIRE(format_check_exp1 == s);
216 res = res + s.size();
221 BENCHMARK(
"snprintf rsrved bench") {
222 volatile size_t res = 0;
223 for(
size_t i = 0; i <
loops; ++i ) {
228 size_t nchars = std::snprintf(&s[0], bsz,
"%25.21zu", i1);
232 REQUIRE(format_check_exp0 == s);
239TEST_CASE(
"jau_cfmt_benchmark_append_integral02",
"[benchmark][jau][std::string][format_string]") {
240 const size_t loops = 1000;
241 WARN(
"Benchmark with " + std::to_string(
loops) +
" loops");
244 const uint64_t i1 = std::numeric_limits<uint64_t>::max();
245 static constexpr const char *format_check_exp1 =
" 018'446'744'073'709'551'615";
246 static constexpr const char *format_check_exp0 =
" 018446744073709551615";
253 std::cout <<
"flags: " << o1 <<
"\n";
259 jau::cfmt::impl::append_integral(s, s.max_size(), i1,
false, o1,
false);
260 REQUIRE(format_check_exp1 == s);
263 BENCHMARK(
"append_integral rsrved bench") {
264 volatile size_t res = 0;
265 for(
size_t i = 0; i <
loops; ++i ) {
269 jau::cfmt::impl::append_integral(s, s.max_size(), i1,
false, o1,
false);
270 REQUIRE(format_check_exp1 == s);
271 res = res + s.size();
276 BENCHMARK(
"snprintf rsrved bench") {
277 volatile size_t res = 0;
278 for(
size_t i = 0; i <
loops; ++i ) {
283 size_t nchars = std::snprintf(&s[0], bsz,
"%25.21zu", i1);
287 REQUIRE(format_check_exp0 == s);