/ src / bench / strencodings.cpp
strencodings.cpp
 1  // Copyright (c) 2022 The Bitcoin Core developers
 2  // Distributed under the MIT software license, see the accompanying
 3  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
 4  
 5  #include <bench/bench.h>
 6  #include <bench/data/block413567.raw.h>
 7  #include <span.h>
 8  #include <util/strencodings.h>
 9  
10  #include <vector>
11  
12  static void HexStrBench(benchmark::Bench& bench)
13  {
14      auto const& data = benchmark::data::block413567;
15      bench.batch(data.size()).unit("byte").run([&] {
16          auto hex = HexStr(data);
17          ankerl::nanobench::doNotOptimizeAway(hex);
18      });
19  }
20  
21  BENCHMARK(HexStrBench, benchmark::PriorityLevel::HIGH);