From fa31a8166ec3ffb7f3d4ed0ddf6d863158dba479 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Sat, 23 Nov 2024 08:21:12 +0800 Subject: [PATCH] feat: benchmark of CommonCode checker --- src/core/benchmark/codec.cc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/core/benchmark/codec.cc b/src/core/benchmark/codec.cc index 847acb6..b7422bc 100644 --- a/src/core/benchmark/codec.cc +++ b/src/core/benchmark/codec.cc @@ -260,12 +260,27 @@ static void IsMirrorCompare(benchmark::State &state) { } } +static void CommonCodeCheck(benchmark::State &state) { + + std::vector samples = common_code_samples(state.range(0)); + + for (auto _ : state) { + for (auto code : samples) { + volatile auto tmp = CommonCode::check(code); + } + } + + state.SetItemsProcessed(state.iterations() * state.range(0)); +} + +BENCHMARK(CommonCodeCheck)->Range(64, 1024); + // BENCHMARK(CommonCodeSerialize)->Range(8, 256); -BENCHMARK(CommonCodeDeserialize)->Range(8, 256); +//BENCHMARK(CommonCodeDeserialize)->Range(8, 256); // BENCHMARK(CommonCodeSerializeShorten)->Range(8, 256); // BENCHMARK(CommonCodeDeserializeShorten)->Range(8, 256); -// BENCHMARK(ShortCodeSerialize)->Range(8, 256); +//BENCHMARK(ShortCodeSerialize)->Range(8, 256); // BENCHMARK(ShortCodeDeserialize)->Range(8, 256); // BENCHMARK(IsMirrorCompare);