登录 注册

benchmark

去点 Star
其他
10,509
Stars
1,827
Forks
197
Watchers
167
Open Issues
Apache-2.0
许可证
C++
语言
2013-12-12
创建时间
2026-11-10
最近更新

项目能做什么

Google 开源的 C++ 微基准测试(microbenchmark)支持库。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
# Benchmark

[![build-and-test](https://github.com/google/benchmark/workflows/build-and-test/badge.svg)](https://github.com/google/benchmark/actions?query=workflow%3Abuild-and-test)
[![bazel](https://github.com/google/benchmark/actions/workflows/bazel.yml/badge.svg)](https://github.com/google/benchmark/actions/workflows/bazel.yml)
[![test-bindings](https://github.com/google/benchmark/workflows/test-bindings/badge.svg)](https://github.com/google/benchmark/actions?query=workflow%3Atest-bindings)
[![Coverage Status](https://coveralls.io/repos/google/benchmark/badge.svg)](https://coveralls.io/r/google/benchmark)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/google/benchmark/badge)](https://securityscorecards.dev/viewer/?uri=github.com/google/benchmark)

[![Discord](https://discordapp.com/api/guilds/1125694995928719494/widget.png?style=shield)](https://discord.gg/cz7UX7wKC2)

A library to benchmark code snippets, similar to unit tests. Example:

```c++
#include <benchmark/registration.h>
#include <benchmark/state.h>

static void BM_SomeFunction(benchmark::State& state) {
  // Perform setup here
  for (auto _ : state) {
    // This code gets timed
    SomeFunction();
  }
}
// Register the function as a benchmark
BENCHMARK(BM_SomeFunction);
// Run the benchmark
BENCHMARK_MAIN();
```

## Getting Started

To get started, see [Requirements](#requirements) and
[Installation](#installation). See [Usage](#usage) for a full example and the
[User Guide](docs/user_guide.md) for a more comprehensive feature overview.

It may also help to read the [Google Test documentation](https://github.com/google/googletest/blob/main/docs/primer.md)
as some of the structural aspects of the APIs are similar.

## Resources

[Discussion group](https://groups.google.com/d/forum/benchmark-discuss)

IRC channels:
* [libera](https://libera.chat) #benchmark

[Additional Tooling Documentation](docs/tools.md)

[Assembly Testing Documentation](docs/AssemblyTests.md)

[Building and installing Python bindings](docs/python_bindings.md)

## Requirements

The library can be used with C++11. However, it requires C++17 to build,
including compiler and standard library support.

_See [dependencies.md](docs/dependencies.md) for more details regarding supported
compilers and standards._

If you have need for a particular compiler to be supported, patches are very welcome.

See [Platform-Specific Build Instructions](docs/platform_specific_build_instructions.md).

## Installation

This describes the installation process using cmake. As pre-requisites, you'll
need git and cmake installed.

_See [dependencies.md](docs/dependencies.md) for more details regarding supported
versions of build tools._

```bash
# Check out the library.
$ git clone https://github.com/google/benchmark.git
# Go to the library root directory
$ cd benchmark
# Make a build directory to place the build output.
$ cmake -E make_directory "build"
# Generate build system files with cmake, and download an
阅读完整原文

项目深度分析 AI 生成

CI/CD 持续基准测试与性能回归监控 SaaS

产品构想基于 google/benchmark 的输出(JSON 格式),构建一个开箱即用的 GitHub/GitLab Action 和云端看板,在 PR 级别自动比对性能波动并阻断性能衰退。
核心功能GitHub App 一键接入、多 commit 性能基准对比图表、PR 性能劣化告警阈值阻断、噪声过滤与统计学显著性分析(P-value)。
目标用户开源项目维护者、中小型高性能基础设施研发团队、算法/算子优化团队。
难度/周期中等 · 4-6 周 · 成本:极低(纯 SaaS 服务架构,跑在 Vercel/Supabase + 少量评测云服务器)
收费模式免费额度 + 团队订阅制(按月/按席位或监控仓库数量收费)。
竞争风险裸机性能测试需要稳定低噪环境,公有云虚拟机的噪声波动可能导致测试结果不稳定(需要统计学校正或私有 Runner)。
依据 已验证事实(google/benchmark 原生支持输出 JSON 结果供二次分析)

跨架构裸机性能基准测试与硬件对比平台

产品构想提供统一的硬件测试矩阵(x86、ARM、RISC-V 等),用户上传基于 google/benchmark 的测试代码,自动化在多硬件平台编译执行并输出横向对比报告。
核心功能主流与边缘硬件统一调用 API、google/benchmark 自动化编译沙箱、不同架构的指令周期与能耗对比分析看板。
目标用户跨平台库维护者、编译器开发者、嵌入式系统芯片方案选型企业。
难度/周期高 · 2-3 个月 · 成本:中等偏高(需采购或租赁多种物理架构服务器/板卡设备)
收费模式按使用量付费(每次测试任务计费)或企业硬件评测专属订阅包。
竞争风险硬件采购与维护成本高,物理测试节点容易成为瓶颈,市场相对垂直。
依据 数据支持的判断(C++ 生态中多架构移植验证属于普遍痛点)

企业级性能测试分析套件(内网私有部署版)

产品构想面向对代码保密要求极高的自研企业,提供与 google/benchmark 深度整合的私有化性能监控、火焰图结合与测试用例生命周期管理系统。
核心功能完全内网离线部署、集成 Linux perf/火焰图联动、历史大版本性能基线对比、多环境权限与审计报告导出。
目标用户高频量化交易机构、金融基础架构团队、大型游戏引擎自研团队、车载操作系统研发商。
难度/周期中等 · 1-2 个月 · 成本:低(软件交付形态为主)
收费模式按年授权费(License)+ 实施部署与维保技术支持服务。
竞争风险大企业销售周期长,客户对定制化支持要求高,个人开发者获客门槛高。
依据 AI推测
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

相似项目数据正在完善中,暂不展示(避免误导)

项目优势与风险

技术成熟度创建于 2013-12-12,近 30 天仍在推送,发布过 31 个 Release
社区活跃Star 10,509 / Fork 1,827 / Issue 167(数据支持,可自行核实)
许可证Apache-2.0
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。