| 484 | // Benchmark the worst case of comparing two identical bitmap |
| 485 | template <int64_t Offset = 0> |
| 486 | static void BitmapEquals(benchmark::State& state) { |
| 487 | const int64_t buffer_size = state.range(0); |
| 488 | const int64_t bits_size = buffer_size * 8; |
| 489 | std::shared_ptr<Buffer> buffer = CreateRandomBuffer(buffer_size); |
| 490 | |
| 491 | const uint8_t* src = buffer->data(); |
| 492 | const int64_t offset = Offset; |
| 493 | const int64_t length = bits_size - offset; |
| 494 | |
| 495 | auto copy = *AllocateEmptyBitmap(length + offset); |
| 496 | internal::CopyBitmap(src, 0, length, copy->mutable_data(), offset); |
| 497 | |
| 498 | for (auto _ : state) { |
| 499 | auto is_same = internal::BitmapEquals(src, 0, copy->data(), offset, length); |
| 500 | benchmark::DoNotOptimize(is_same); |
| 501 | } |
| 502 | |
| 503 | state.SetBytesProcessed(state.iterations() * buffer_size); |
| 504 | } |
| 505 | |
| 506 | static void BitmapEqualsWithoutOffset(benchmark::State& state) { BitmapEquals<0>(state); } |
| 507 |
nothing calls this directly
no test coverage detected