Fix benchmark C++11 code
Some checks failed
ci / CI ubuntu-latest avx clang debug (push) Failing after 12s
ci / CI ubuntu-latest avx clang release (push) Failing after 8s
ci / CI ubuntu-latest avx2 clang debug (push) Failing after 8s
ci / CI ubuntu-latest avx2 clang release (push) Failing after 9s
ci / CI ubuntu-latest baseline clang debug (push) Failing after 9s
ci / CI ubuntu-latest baseline clang release (push) Failing after 8s
ci / CI ubuntu-latest avx gcc debug (push) Failing after 9s
ci / CI ubuntu-latest avx gcc release (push) Failing after 8s
ci / CI ubuntu-latest avx2 gcc debug (push) Failing after 8s
ci / CI ubuntu-latest avx2 gcc release (push) Failing after 8s
ci / CI ubuntu-latest baseline gcc debug (push) Failing after 8s
ci / CI ubuntu-latest baseline gcc release (push) Failing after 8s
riscv64-qemu-test / test (push) Successful in 4m39s
ci / CI windows-latest avx msvc debug (push) Has been cancelled
ci / CI windows-latest avx msvc release (push) Has been cancelled
ci / CI windows-latest avx2 msvc debug (push) Has been cancelled
ci / CI windows-latest avx2 msvc release (push) Has been cancelled
ci / CI windows-latest baseline msvc debug (push) Has been cancelled
ci / CI windows-latest baseline msvc release (push) Has been cancelled
ci / CI macos-latest avx clang debug (push) Has been cancelled
ci / CI macos-latest avx clang release (push) Has been cancelled
ci / CI macos-latest baseline clang debug (push) Has been cancelled
ci / CI macos-latest baseline clang release (push) Has been cancelled

This commit is contained in:
Danila Kutenin
2026-05-09 18:58:29 +00:00
parent f6f696553b
commit 27ab5f7f51

View File

@@ -31,12 +31,10 @@
#include <string>
#include <vector>
#include "snappy-test.h"
#include "benchmark/benchmark.h"
#include "snappy-internal.h"
#include "snappy-sinksource.h"
#include "snappy-test.h"
#include "snappy.h"
#include "snappy_test_data.h"
@@ -44,7 +42,7 @@ namespace snappy {
namespace {
void FilesAndLevels(::testing::Benchmark* benchmark) {
void FilesAndLevels(benchmark::internal::Benchmark* benchmark) {
for (int i = 0; i < ARRAYSIZE(kTestDataFiles); ++i) {
for (int level = snappy::CompressionOptions::MinCompressionLevel();
level <= snappy::CompressionOptions::MaxCompressionLevel(); ++level) {
@@ -64,8 +62,9 @@ void BM_UFlat(benchmark::State& state) {
kTestDataFiles[file_index].size_limit);
std::string zcontents;
snappy::Compress(contents.data(), contents.size(), &zcontents,
snappy::CompressionOptions{/*level=*/state.range(1)});
snappy::Compress(
contents.data(), contents.size(), &zcontents,
snappy::CompressionOptions{/*level=*/static_cast<int>(state.range(1))});
char* dst = new char[contents.size()];
for (auto s : state) {
@@ -129,8 +128,9 @@ void BM_UValidate(benchmark::State& state) {
kTestDataFiles[file_index].size_limit);
std::string zcontents;
snappy::Compress(contents.data(), contents.size(), &zcontents,
snappy::CompressionOptions{/*level=*/state.range(1)});
snappy::Compress(
contents.data(), contents.size(), &zcontents,
snappy::CompressionOptions{/*level=*/static_cast<int>(state.range(1))});
for (auto s : state) {
CHECK(snappy::IsValidCompressedBuffer(zcontents.data(), zcontents.size()));
@@ -226,7 +226,7 @@ void BM_UIOVecSink(benchmark::State& state) {
// Uncompress into an iovec containing ten entries.
const int kNumEntries = 10;
struct iovec iov[kNumEntries];
char *dst = new char[contents.size()];
char* dst = new char[contents.size()];
size_t used_so_far = 0;
for (int i = 0; i < kNumEntries; ++i) {
iov[i].iov_base = dst + used_so_far;
@@ -267,8 +267,9 @@ void BM_UFlatSink(benchmark::State& state) {
kTestDataFiles[file_index].size_limit);
std::string zcontents;
snappy::Compress(contents.data(), contents.size(), &zcontents,
snappy::CompressionOptions{/*level=*/state.range(1)});
snappy::Compress(
contents.data(), contents.size(), &zcontents,
snappy::CompressionOptions{/*level=*/static_cast<int>(state.range(1))});
char* dst = new char[contents.size()];
for (auto s : state) {