Best accurate way to measure/compare elapsed time in C++

This page summarizes the projects mentioned and recommended in the original post on /r/cpp

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • benchmark

    A microbenchmark support library

  • CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
  • coz

    Coz: Causal Profiling

    https://github.com/plasma-umass/coz https://youtu.be/7g1Acy5eGbE

  • Kalman

    Kalman Filter (by FrancoisCarouge)

    I use it with boilerplate similar to this: https://github.com/FrancoisCarouge/Kalman/blob/develop/benchmark/benchmark.cpp and run the executables with priority and pining: nice -n 20 tasker -- cpu-list 0

  • hyperfine

    A command-line benchmarking tool

    I have used hyperfine in the past, a rust CLI based tool to measure performance. you'd have to make some small changes, since hyperfine will measure the entire binary and not just parts of it, but it comes with some useful functions like warmup runs, graphical output and statistical analysis across multiple runs.

  • perfstat

    Python program for measuring performance statistics

    Perfstat - Performance statistics

  • nanobench

    Simple, fast, accurate single-header microbenchmarking functionality for C++11/14/17/20

    Of course, the best way to benchmark is nanobench: https://nanobench.ankerl.com/

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • how do you properly benchmark?

    2 projects | /r/cpp | 20 Feb 2023
  • Calculate Your Code Performance

    5 projects | dev.to | 23 Oct 2021
  • Open Source C

    2 projects | /r/C_Programming | 20 Jan 2021
  • std::array in C++ isn't slower than array in C

    2 projects | dev.to | 27 Sep 2024
  • Tracy: A real time, nanosecond resolution frame profiler

    4 projects | news.ycombinator.com | 23 Sep 2024

Did you konow that C++ is
the 7th most popular programming language
based on number of metions?