A C++ performance benchmark framework with nanosecond precision for measuring execution time, throughput, and latency.
CppBenchmark is a performance benchmark framework for C++ that provides nanosecond-precision measurements for code execution time, throughput, and latency. It helps developers analyze and optimize performance across various scenarios, from simple function calls to complex multi-threaded and producer-consumer patterns. The framework supports detailed metrics like average/minimal/maximal times, items processing speed, and I/O throughput.
C++ developers and performance engineers who need to measure and optimize code performance, especially those working on low-latency systems, high-throughput applications, or multi-threaded algorithms.
Developers choose CppBenchmark for its high precision (nanosecond measurements), comprehensive feature set (including HDR histograms and multi-threaded benchmarks), and cross-platform support. It offers both simplicity for quick micro-benchmarks and advanced capabilities for complex real-world performance analysis.
Performance benchmark framework for C++ with nanoseconds measure precision
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides nanosecond accuracy for function calls, as shown in examples like benchmarking sin() with 6 ns average time, enabling fine-grained performance analysis.
Supports configurable thread counts and producer-consumer patterns, demonstrated in examples with atomic operations and mutex queues, ideal for concurrent code profiling.
Verified builds across Linux, macOS, and Windows with various compilers (GCC, Clang, Visual Studio), indicated by extensive CI badges in the README.
Integrates High Dynamic Range (HDR) histograms for latency measurement, allowing in-depth profiling and visualization, as seen in examples with sleep and clock benchmarks.
Allows benchmarks with single, pair, or triple parameters, including ranges and custom selectors, enabling comprehensive scenario testing without code duplication.
Requires installing multiple dependencies like gil (git links), Python, and CMake, which can be time-consuming and error-prone compared to header-only libraries.
Lacks mention of plugins or integrations with popular profiling tools or IDEs, potentially isolating it in toolchains and increasing manual effort for reporting.
For basic micro-benchmarks, the API and fixture-based approach might be overkill, adding unnecessary complexity compared to simpler alternatives like std::chrono.
Relies on the author's proprietary git links tool (gil) for repository management, creating vendor lock-in and potential maintenance risks if the tool is deprecated.