# martinus/nanobench

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

Repository: https://github.com/martinus/nanobench
Canonical: https://ross.abutalabs.com/products/nanobench
Homepage: https://nanobench.ankerl.com
Language: C++
License: MIT
License Family: permissive
Topics: benchmark, cpp, microbenchmark, single-header, single-header-lib, single-file, header-only, cpp11
Last push: 2026-08-23T11:14:37+00:00

## Health v2 (maintenance only)
Score: 99/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 98, longevity 100
- inputs: {"age_days": 2524, "days_push": 10, "days_rel": 19, "gap_med": 0.0, "n_releases_24m": 3}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1730, forks 104 (observed 2026-08-28T04:05:28.576257+00:00)

## What it is
ankerl::nanobench is a single-header, platform-independent microbenchmarking library for C++11/14/17/20. It measures ns/op, op/s, instructions, cycles, IPC, and branch misses with fast, accurate, repeatable results.

## Use cases
- benchmark small C++ code snippets
- measure nanoseconds per operation in C++
- compare performance of C++ implementations
- profile instruction counts and branch misses of hot code
- add microbenchmarks to a C++ project with minimal setup
- replace google benchmark with a faster, header-only alternative

## When to choose
- you need quick, accurate microbenchmarks in C++ with zero build complexity
- you want a single-header library that integrates via CMake FetchContent or direct inclusion
- you need detailed metrics like IPC and branch prediction misses

## When to avoid
- you need full application profiling rather than microbenchmarking
- you are not working in C++
- you need distributed or long-running benchmarking infrastructure

## Facets
- artifact type: library
- maturity: stable
- function: benchmarking
- domain: developer-tools, performance
- platform: cross-platform, cpp
- tags: header-only, single-header, microbenchmark, cpp11, performance-measurement

## Member repositories
- martinus/nanobench (main) score 99

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:28.576257+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:31:45.509219+00:00, confidence not recorded.
  - readme: https://github.com/martinus/nanobench (fetched 2026-08-28T04:05:28.576257+00:00, sha aee331852b57)
  - homepage: https://nanobench.ankerl.com (fetched 2026-08-29T11:08:36.107606+00:00, sha c7713e3b69ca)
  - site_page: https://nanobench.ankerl.com/tutorial.html (fetched 2026-08-29T11:08:36.110418+00:00, sha b05fe497704f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
