llvm-project/libcxx/test/benchmarks/variant_visit_3.bench.cpp
Louis Dionne 439bef9751
[libc++] Refactor the sequence container benchmarks (#119763)
Rewrite the sequence container benchmarks to only rely on the actual
operations specified in SequenceContainer requirements and add
benchmarks for std::list, which is also considered a sequence container.

One of the major goals of this refactoring is also to make these
container benchmarks run faster so that they can be run more frequently.
The existing benchmarks have the significant problem that they take so
long to run that they must basically be run overnight. This patch
reduces the size of inputs such that the rewritten benchmarks each take
at most a minute to run.

This patch doesn't touch the string benchmarks, which were not using the
generic container benchmark functions previously.
2025-01-30 15:02:34 -05:00

31 lines
862 B
C++

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
#include "benchmark/benchmark.h"
#include "VariantBenchmarks.h"
using namespace VariantBenchmarks;
BENCHMARK(BM_Visit<3, 1>);
BENCHMARK(BM_Visit<3, 2>);
BENCHMARK(BM_Visit<3, 3>);
BENCHMARK(BM_Visit<3, 4>);
BENCHMARK(BM_Visit<3, 5>);
BENCHMARK(BM_Visit<3, 6>);
BENCHMARK(BM_Visit<3, 7>);
BENCHMARK(BM_Visit<3, 8>);
BENCHMARK(BM_Visit<3, 9>);
BENCHMARK(BM_Visit<3, 10>);
BENCHMARK(BM_Visit<3, 15>);
BENCHMARK(BM_Visit<3, 20>);
BENCHMARK_MAIN();