如何在https://quick-bench.com上基准fmt ::格式API
我正在尝试理解和基准测试FMT ::格式化API( https:///fmt.dev/fmt.dev/latest/api/api/api/api-papi- .html )。我在编译器资源管理器中写了一个简单的测试。
#include <benchmark/benchmark.h>
#include <fmt/core.h>
static void BM_format(benchmark::State& state) {
// Perform setup here
for (auto _ : state)
{
std::string s = fmt::format( "{}", "testing fmt::format in benchmark");
}
}
// Register the function as a benchmark
BENCHMARK(BM_format);
// Run the benchmark
BENCHMARK_MAIN();
然后,我从Compile Explorer启动了快速基础。 在快速基础上,它给出了一个错误
错误或超时台式file.cpp:2:10:致命错误:fmt/core.h:否这样 文件或目录 2 | #include&lt; fmt/core.h&gt; | ^~~~~~~~~~~~~汇编终止。
C ++ FMT库是否在快速台上支持以使其编译和执行?如果没有,有其他选择。
I am trying to understand and benchmark fmt::format API ( https://fmt.dev/latest/api.html ). I wrote a simple test in compiler explorer i.e, https://godbolt.org/z/fMcf3nczE.
#include <benchmark/benchmark.h>
#include <fmt/core.h>
static void BM_format(benchmark::State& state) {
// Perform setup here
for (auto _ : state)
{
std::string s = fmt::format( "{}", "testing fmt::format in benchmark");
}
}
// Register the function as a benchmark
BENCHMARK(BM_format);
// Run the benchmark
BENCHMARK_MAIN();
Then, I launched quick-bench from compile explorer.
In quick-bench, it gives an error as
Error or timeout bench-file.cpp:2:10: fatal error: fmt/core.h: No such
file or directory
2 | #include <fmt/core.h>
| ^~~~~~~~~~~~ compilation terminated.
Is the c++ fmt library supported in quick-bench so that it compiles and executes? if not, any alternative.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,快速台不支持需要单独汇编的外部库( )。附带说明,它确实不支持包含在内通过URL的仅标题库。
我会说,在这种特定情况下,您可以使用C ++ 20
std ::格式
,如果您不专门与FMT LIB相关。但是不幸的是,Clang 14和GCC 11(或更确切地说是LIBC ++和LIBSTDC ++)尚未实施。因此,我担心您问的是完全不可能的。您需要在自己的计算机上进行基准测试。
Unfortunately, quick-bench does not support external libraries which require separate compilation (as fmt does). As a side note, it does not support the inclusion of header-only libraries via URLs, either.
I would have said that in this specific case you could use C++20
std::format
instead, if you are not tied to fmt lib specifically. But unfortunately, neither clang 14 nor gcc 11 (or rather, libc++ and libstdc++) have implemented it yet.So I fear what you ask is simply impossible right now. You need to benchmark on your own computer.