Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / benchmarks / system_error.bench.cpp
blob8506efef132634e252a238620969c017c45638f6
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03
11 #include <string>
12 #include <system_error>
14 #include "benchmark/benchmark.h"
16 static void BM_SystemErrorWithMessage(benchmark::State& state) {
17 for (auto _ : state) {
18 std::error_code ec{};
19 benchmark::DoNotOptimize(std::system_error{ec, ""});
22 BENCHMARK(BM_SystemErrorWithMessage);
24 static void BM_SystemErrorWithoutMessage(benchmark::State& state) {
25 for (auto _ : state) {
26 std::error_code ec{};
27 benchmark::DoNotOptimize(std::system_error{ec});
30 BENCHMARK(BM_SystemErrorWithoutMessage);
32 BENCHMARK_MAIN();