format utility improvements
This commit is contained in:
@@ -175,12 +175,11 @@ void benchmark_error_messages() {
|
||||
constexpr int line_number = 123;
|
||||
const std::string error_msg = "File not found";
|
||||
|
||||
// Arena-based static_format (using std::string_view)
|
||||
// Arena-based static_format (using string literals only)
|
||||
bench.run("static_format", [&] {
|
||||
ArenaAllocator arena(128);
|
||||
std::string_view error_msg_sv = error_msg;
|
||||
auto result = static_format(arena, "Error ", error_code, ": ", error_msg_sv,
|
||||
" (line ", line_number, ")");
|
||||
auto result = static_format(arena, "Error ", error_code, ": ",
|
||||
"File not found", " (line ", line_number, ")");
|
||||
ankerl::nanobench::doNotOptimizeAway(result);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user