CheckOps
Google Benchmark
Google Benchmark is Google's Apache-2.0 C++ microbenchmarking library that lets you register benchmark functions like unit tests, with argument ranges, complexity estimates, multithreading and JSON output.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
Google Benchmark is a library for benchmarking code snippets, similar to unit tests. You define a function that executes the code to measure, register it with the BENCHMARK macro and provide a main function (or link benchmark_main), then compile and run the binary. The API resembles Google Test in structure, and the library uses Google Test for its own tests.
It can be used with C++11 but requires C++17 to build. Installation is via CMake; the README walks through generating build files with -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on and -DCMAKE_BUILD_TYPE=Release and warns that by default the library builds in debug mode. It supports link-time optimisation and sanitiser builds.
Benchmarks can be run with multiple threads, and the user guide documents the full feature set, from parameterised benchmarks to output options. The main branch holds the stable API, while experimental features are tested on a separate branch.
C++ performance work is where microbenchmarks matter most, and Google Benchmark is the de facto standard. Pair it with a continuous benchmarking service such as Bencher or CodSpeed to track results over time rather than comparing runs by hand. Whatever tool you choose, benchmark results are only useful if they are stable. Pin the hardware or runner, run enough iterations to make variance visible, and treat a single noisy result as a reason to rerun, not to block a merge.
The source code is at google/benchmark on GitHub under the Apache-2.0 licence, with about 10,500 stars; the most recent commit was on 10 November 2026.
Features
- Macro-based registration: Benchmarks like unit tests.
- benchmark_main: Ready-made main function.
- Multithreaded runs: Measure concurrency.
- Stable and experimental branches: Stable API on main.
- Sanitiser and LTO builds: Documented build options.
- CMake integration: Standard build.
Pros
- Industry standard: Widely used in C++ projects.
- Free to use: Open source under the Apache-2.0 licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 10 November 2026.
- Community: About 10,500 GitHub stars.
Cons
- Build setup: CMake and C++17 to build.
- Debug default: Must build in Release for accurate numbers.
Usage and Links (Example)
#include <benchmark/benchmark.h>
static void BM_StringCreation(benchmark::State& state) {
for (auto _ : state) std::string empty_string;
}
BENCHMARK(BM_StringCreation);
BENCHMARK_MAIN();
cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release -S . -B build
cmake --build build --config Release
Resources:
Pricing
Google Benchmark is free and open source under the Apache-2.0 licence.
Recommended for?
- C++ developers measuring hot code paths.
Conclusion
Google Benchmark is the default C++ microbenchmarking library.
Always build it in Release mode.
On CheckOps, Google Benchmark is filed under the Performance & load and Unit testing stages. Related tools listed here include hyperfine, BenchmarkDotNet, JMH, cargo-nextest, K6 and pytest. A short trial on a real project, with your own code, data and pipeline, is usually the fastest way to choose between them, because fit matters more than feature lists. Facts here come from the official site, documentation and repository, checked on 11 November 2026.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with Google Benchmark side by side.
Hhyperfinehyperfine is an Apache-2.0 command-line benchmarking tool that runs shell commands repeatedly with warm-up, statistical analysis and exports, ideal for comparing CLIs and builds.Compare with Google Benchmark
BBenchmarkDotNetBenchmarkDotNet is the MIT-licensed .NET library for turning methods into reliable, reproducible micro-benchmarks with statistical analysis, diagnosers and exportable reports.Compare with Google Benchmark
JJMHJMH (Java Microbenchmark Harness) is OpenJDK's GPL-2.0 harness for building, running and analysing nano, micro, milli and macro benchmarks in Java and other JVM languages.Compare with Google Benchmark
Ccargo-nextestcargo-nextest is an Apache-2.0 next-generation test runner for Rust, up to 3x faster than cargo test per its site, with per-test process isolation, retries, partitioning, JUnit output and a filterset DSL.Compare with Google Benchmark
KK6k6 is an open-source tool and cloud service that makes load testing easy for developers and QA engineers.Compare with Google Benchmark- Ppytestpytest is the usual Python test runner: plain asserts, fixtures, parametrization, and a large plugin set.Compare with Google Benchmark