[bm] fix std::to_chars()/std::from_chars() benchmarks: were not called

This commit is contained in:
Joao Paulo Magalhaes
2022-08-30 23:59:48 +02:00
parent cad3d1f1b3
commit 492dfa975d
3 changed files with 20 additions and 20 deletions

View File

@@ -1125,7 +1125,7 @@ atox_c4_from_chars(bm::State& st)
report<T>(st, kNumValues);
}
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4FOR(T, isint)
xtoa_std_to_chars(bm::State& st)
{
@@ -1285,7 +1285,7 @@ C4BM_TEMPLATE(xtoa_c4_write_dec, uint8_t);
C4BM_TEMPLATE(xtoa_c4_utoa, uint8_t);
C4BM_TEMPLATE(xtoa_c4_xtoa, uint8_t);
C4BM_TEMPLATE(xtoa_c4_to_chars, uint8_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(xtoa_std_to_chars, uint8_t);
#endif
C4BM_TEMPLATE(xtoa_std_to_string, uint8_t);
@@ -1297,7 +1297,7 @@ C4BM_TEMPLATE(xtoa_c4_write_dec, int8_t);
C4BM_TEMPLATE(xtoa_c4_itoa, int8_t);
C4BM_TEMPLATE(xtoa_c4_xtoa, int8_t);
C4BM_TEMPLATE(xtoa_c4_to_chars, int8_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(xtoa_std_to_chars, int8_t);
#endif
C4BM_TEMPLATE(xtoa_std_to_string, int8_t);
@@ -1309,7 +1309,7 @@ C4BM_TEMPLATE(xtoa_c4_write_dec, uint16_t);
C4BM_TEMPLATE(xtoa_c4_utoa, uint16_t);
C4BM_TEMPLATE(xtoa_c4_xtoa, uint16_t);
C4BM_TEMPLATE(xtoa_c4_to_chars, uint16_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(xtoa_std_to_chars, uint16_t);
#endif
C4BM_TEMPLATE(xtoa_std_to_string, uint16_t);
@@ -1321,7 +1321,7 @@ C4BM_TEMPLATE(xtoa_c4_write_dec, int16_t);
C4BM_TEMPLATE(xtoa_c4_itoa, int16_t);
C4BM_TEMPLATE(xtoa_c4_xtoa, int16_t);
C4BM_TEMPLATE(xtoa_c4_to_chars, int16_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(xtoa_std_to_chars, int16_t);
#endif
C4BM_TEMPLATE(xtoa_std_to_string, int16_t);
@@ -1333,7 +1333,7 @@ C4BM_TEMPLATE(xtoa_c4_write_dec, uint32_t);
C4BM_TEMPLATE(xtoa_c4_utoa, uint32_t);
C4BM_TEMPLATE(xtoa_c4_xtoa, uint32_t);
C4BM_TEMPLATE(xtoa_c4_to_chars, uint32_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(xtoa_std_to_chars, uint32_t);
#endif
C4BM_TEMPLATE(xtoa_std_to_string, uint32_t);
@@ -1345,7 +1345,7 @@ C4BM_TEMPLATE(xtoa_c4_write_dec, int32_t);
C4BM_TEMPLATE(xtoa_c4_itoa, int32_t);
C4BM_TEMPLATE(xtoa_c4_xtoa, int32_t);
C4BM_TEMPLATE(xtoa_c4_to_chars, int32_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(xtoa_std_to_chars, int32_t);
#endif
C4BM_TEMPLATE(xtoa_std_to_string, int32_t);
@@ -1357,7 +1357,7 @@ C4BM_TEMPLATE(xtoa_c4_write_dec, uint64_t);
C4BM_TEMPLATE(xtoa_c4_utoa, uint64_t);
C4BM_TEMPLATE(xtoa_c4_xtoa, uint64_t);
C4BM_TEMPLATE(xtoa_c4_to_chars, uint64_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(xtoa_std_to_chars, uint64_t);
#endif
C4BM_TEMPLATE(xtoa_std_to_string, uint64_t);
@@ -1369,7 +1369,7 @@ C4BM_TEMPLATE(xtoa_c4_write_dec, int64_t);
C4BM_TEMPLATE(xtoa_c4_itoa, int64_t);
C4BM_TEMPLATE(xtoa_c4_xtoa, int64_t);
C4BM_TEMPLATE(xtoa_c4_to_chars, int64_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(xtoa_std_to_chars, int64_t);
#endif
C4BM_TEMPLATE(xtoa_std_to_string, int64_t);
@@ -1453,7 +1453,7 @@ C4BM_TEMPLATE(atox_c4_atou, uint8_t);
C4BM_TEMPLATE(atox_c4_atox, uint8_t);
C4BM_TEMPLATE(atox_c4_from_chars, uint8_t);
C4BM_TEMPLATE(atox_c4_from_chars_checked, uint8_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(atox_std_from_chars, uint8_t);
#endif
C4BM_TEMPLATE(atox_std_atoi, uint8_t);
@@ -1467,7 +1467,7 @@ C4BM_TEMPLATE(atox_c4_atoi, int8_t);
C4BM_TEMPLATE(atox_c4_atox, int8_t);
C4BM_TEMPLATE(atox_c4_from_chars, int8_t);
C4BM_TEMPLATE(atox_c4_from_chars_checked, int8_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(atox_std_from_chars, int8_t);
#endif
C4BM_TEMPLATE(atox_std_atoi, int8_t);
@@ -1481,7 +1481,7 @@ C4BM_TEMPLATE(atox_c4_atou, uint16_t);
C4BM_TEMPLATE(atox_c4_atox, uint16_t);
C4BM_TEMPLATE(atox_c4_from_chars, uint16_t);
C4BM_TEMPLATE(atox_c4_from_chars_checked, uint16_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(atox_std_from_chars, uint16_t);
#endif
C4BM_TEMPLATE(atox_std_atoi, uint16_t);
@@ -1495,7 +1495,7 @@ C4BM_TEMPLATE(atox_c4_atoi, int16_t);
C4BM_TEMPLATE(atox_c4_atox, int16_t);
C4BM_TEMPLATE(atox_c4_from_chars, int16_t);
C4BM_TEMPLATE(atox_c4_from_chars_checked, int16_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(atox_std_from_chars, int16_t);
#endif
C4BM_TEMPLATE(atox_std_atoi, int16_t);
@@ -1509,7 +1509,7 @@ C4BM_TEMPLATE(atox_c4_atou, uint32_t);
C4BM_TEMPLATE(atox_c4_atox, uint32_t);
C4BM_TEMPLATE(atox_c4_from_chars, uint32_t);
C4BM_TEMPLATE(atox_c4_from_chars_checked, uint32_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(atox_std_from_chars, uint32_t);
#endif
C4BM_TEMPLATE(atox_std_atoi, uint32_t);
@@ -1523,7 +1523,7 @@ C4BM_TEMPLATE(atox_c4_atoi, int32_t);
C4BM_TEMPLATE(atox_c4_atox, int32_t);
C4BM_TEMPLATE(atox_c4_from_chars, int32_t);
C4BM_TEMPLATE(atox_c4_from_chars_checked, int32_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(atox_std_from_chars, int32_t);
#endif
C4BM_TEMPLATE(atox_std_atoi, int32_t);
@@ -1537,7 +1537,7 @@ C4BM_TEMPLATE(atox_c4_atou, uint64_t);
C4BM_TEMPLATE(atox_c4_atox, uint64_t);
C4BM_TEMPLATE(atox_c4_from_chars, uint64_t);
C4BM_TEMPLATE(atox_c4_from_chars_checked, uint64_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(atox_std_from_chars, uint64_t);
#endif
C4BM_TEMPLATE(atox_std_atol, uint64_t);
@@ -1551,7 +1551,7 @@ C4BM_TEMPLATE(atox_c4_atoi, int64_t);
C4BM_TEMPLATE(atox_c4_atox, int64_t);
C4BM_TEMPLATE(atox_c4_from_chars, int64_t);
C4BM_TEMPLATE(atox_c4_from_chars_checked, int64_t);
#if (C4CPP >= 17)
#if (C4_CPP >= 17)
C4BM_TEMPLATE_TO_CHARS_INT(atox_std_from_chars, int64_t);
#endif
C4BM_TEMPLATE(atox_std_atol, int64_t);

View File

@@ -109,7 +109,7 @@ constexpr bool is_pot(T val)
}
constexpr const uint64_t kSeed = 37;
constexpr const size_t kNumValues = 1u<<20; // 2.1M
constexpr const size_t kNumValues = 1u<<20; // 1.049M
C4_STATIC_ASSERT(is_pot(kNumValues));

View File

@@ -228,7 +228,7 @@ def plot_charconv_xtoa(dir_: str, json_files, is_ftoa: bool):
panel = bm.BenchmarkPanel(json_files, CharconvMeta)
ref = lambda bmrun: get_function_benchmark("sprintf", run=bmrun)
plot_charconv_bars(panel, ref,
f"xtoa benchmark: convert 2M numbers to strings",
f"xtoa benchmark: convert 1M numbers to strings",
f"{dir_}/c4core-bm-charconv-{fcase}")
@@ -237,7 +237,7 @@ def plot_charconv_atox(dir_: str, json_files, is_atof: bool):
panel = bm.BenchmarkPanel(json_files, CharconvMeta)
ref = lambda bmrun: get_function_benchmark("scanf", run=bmrun)
plot_charconv_bars(panel, ref,
f"atox benchmark: convert 2M strings to numbers",
f"atox benchmark: convert 1M strings to numbers",
f"{dir_}/c4core-bm-charconv-{fcase}")