Files
MapLibreParticleLab/benchmark/util/color.benchmark.cpp
Bart Louwers 2a8ebc4906 core: rename mbgl directories to mln (#4511)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-08-22 20:50:14 +02:00

32 lines
1.0 KiB
C++

#include <benchmark/benchmark.h>
#include <string>
#include <vector>
#include <mln/util/color.hpp>
static const std::vector<std::string> testStrings = {"#000000",
"#FFFFFF",
"#FF00FFAA",
"rgba(255, 0, 0, 1.0)",
"rgb(0, 255, 0)",
"blue",
"red",
"invalid-color",
"rgba(255, 255, 255, 0.5)",
"#123"};
namespace {
void ColorParse(benchmark::State& state) {
for (auto _ : state) {
for (const auto& str : testStrings) {
auto result = mln::Color::parse(str);
benchmark::DoNotOptimize(result);
}
}
}
}; // namespace
BENCHMARK(ColorParse);