[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-75702":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":9,"totalLinesOfCode":9,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":9,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":9,"pushedAt":9,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":16,"starSnapshotCount":16,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},75702,"benchmark","google\u002Fbenchmark","google","A microbenchmark support library",null,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fbenchmark","C++",10232,1770,198,158,0,9,20,40,27,44.74,false,"main",[5],"2026-06-12 02:03:35","# Benchmark\n\n[![build-and-test](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fbenchmark\u002Fworkflows\u002Fbuild-and-test\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fbenchmark\u002Factions?query=workflow%3Abuild-and-test)\n[![bazel](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fbenchmark\u002Factions\u002Fworkflows\u002Fbazel.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fbenchmark\u002Factions\u002Fworkflows\u002Fbazel.yml)\n[![test-bindings](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fbenchmark\u002Fworkflows\u002Ftest-bindings\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fbenchmark\u002Factions?query=workflow%3Atest-bindings)\n[![Coverage Status](https:\u002F\u002Fcoveralls.io\u002Frepos\u002Fgoogle\u002Fbenchmark\u002Fbadge.svg)](https:\u002F\u002Fcoveralls.io\u002Fr\u002Fgoogle\u002Fbenchmark)\n[![OpenSSF Scorecard](https:\u002F\u002Fapi.securityscorecards.dev\u002Fprojects\u002Fgithub.com\u002Fgoogle\u002Fbenchmark\u002Fbadge)](https:\u002F\u002Fsecurityscorecards.dev\u002Fviewer\u002F?uri=github.com\u002Fgoogle\u002Fbenchmark)\n\n[![Discord](https:\u002F\u002Fdiscordapp.com\u002Fapi\u002Fguilds\u002F1125694995928719494\u002Fwidget.png?style=shield)](https:\u002F\u002Fdiscord.gg\u002Fcz7UX7wKC2)\n\nA library to benchmark code snippets, similar to unit tests. Example:\n\n```c++\n#include \u003Cbenchmark\u002Fregistration.h>\n#include \u003Cbenchmark\u002Fstate.h>\n\nstatic void BM_SomeFunction(benchmark::State& state) {\n  \u002F\u002F Perform setup here\n  for (auto _ : state) {\n    \u002F\u002F This code gets timed\n    SomeFunction();\n  }\n}\n\u002F\u002F Register the function as a benchmark\nBENCHMARK(BM_SomeFunction);\n\u002F\u002F Run the benchmark\nBENCHMARK_MAIN();\n```\n\n## Getting Started\n\nTo get started, see [Requirements](#requirements) and\n[Installation](#installation). See [Usage](#usage) for a full example and the\n[User Guide](docs\u002Fuser_guide.md) for a more comprehensive feature overview.\n\nIt may also help to read the [Google Test documentation](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgoogletest\u002Fblob\u002Fmain\u002Fdocs\u002Fprimer.md)\nas some of the structural aspects of the APIs are similar.\n\n## Resources\n\n[Discussion group](https:\u002F\u002Fgroups.google.com\u002Fd\u002Fforum\u002Fbenchmark-discuss)\n\nIRC channels:\n* [libera](https:\u002F\u002Flibera.chat) #benchmark\n\n[Additional Tooling Documentation](docs\u002Ftools.md)\n\n[Assembly Testing Documentation](docs\u002FAssemblyTests.md)\n\n[Building and installing Python bindings](docs\u002Fpython_bindings.md)\n\n## Requirements\n\nThe library can be used with C++11. However, it requires C++17 to build,\nincluding compiler and standard library support.\n\n_See [dependencies.md](docs\u002Fdependencies.md) for more details regarding supported\ncompilers and standards._\n\nIf you have need for a particular compiler to be supported, patches are very welcome.\n\nSee [Platform-Specific Build Instructions](docs\u002Fplatform_specific_build_instructions.md).\n\n## Installation\n\nThis describes the installation process using cmake. As pre-requisites, you'll\nneed git and cmake installed.\n\n_See [dependencies.md](docs\u002Fdependencies.md) for more details regarding supported\nversions of build tools._\n\n```bash\n# Check out the library.\n$ git clone https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fbenchmark.git\n# Go to the library root directory\n$ cd benchmark\n# Make a build directory to place the build output.\n$ cmake -E make_directory \"build\"\n# Generate build system files with cmake, and download any dependencies.\n$ cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release -S . -B \"build\"\n# Build the library.\n$ cmake --build \"build\" --config Release\n```\nThis builds the `benchmark` and `benchmark_main` libraries and tests.\nOn a unix system, the build directory should now look something like this:\n\n```\n\u002Fbenchmark\n  \u002Fbuild\n    \u002Fsrc\n      \u002Flibbenchmark.a\n      \u002Flibbenchmark_main.a\n    \u002Ftest\n      ...\n```\n\nNext, you can run the tests to check the build.\n\n```bash\n$ cmake -E chdir \"build\" ctest --build-config Release\n```\n\nIf you want to install the library globally, also run:\n\n```\nsudo cmake --build \"build\" --config Release --target install\n```\n\nNote that Google Benchmark requires Google Test to build and run the tests. This\ndependency can be provided two ways:\n\n* Checkout the Google Test sources into `benchmark\u002Fgoogletest`.\n* Otherwise, if `-DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON` is specified during\n  configuration as above, the library will automatically download and build\n  any required dependencies.\n\nIf you do not wish to build and run the tests, add `-DBENCHMARK_ENABLE_GTEST_TESTS=OFF`\nto `CMAKE_ARGS`.\n\n### Debug vs Release\n\nBy default, benchmark builds as a debug library. You will see a warning in the\noutput when this is the case. To build it as a release library instead, add\n`-DCMAKE_BUILD_TYPE=Release` when generating the build system files, as shown\nabove. The use of `--config Release` in build commands is needed to properly\nsupport multi-configuration tools (like Visual Studio for example) and can be\nskipped for other build systems (like Makefile).\n\nTo enable link-time optimisation, also add `-DBENCHMARK_ENABLE_LTO=true` when\ngenerating the build system files.\n\nIf you are using gcc, you might need to set `GCC_AR` and `GCC_RANLIB` cmake\ncache variables, if autodetection fails.\n\nIf you are using clang, you may need to set `LLVMAR_EXECUTABLE`,\n`LLVMNM_EXECUTABLE` and `LLVMRANLIB_EXECUTABLE` cmake cache variables.\n\nTo enable sanitizer checks (eg., `asan` and `tsan`), add:\n```\n -DCMAKE_C_FLAGS=\"-g -O2 -fno-omit-frame-pointer -fsanitize=address -fsanitize=thread -fno-sanitize-recover=all\"\n -DCMAKE_CXX_FLAGS=\"-g -O2 -fno-omit-frame-pointer -fsanitize=address -fsanitize=thread -fno-sanitize-recover=all \"  \n```\n\n### Stable and Experimental Library Versions\n\nThe main branch contains the latest stable version of the benchmarking library;\nthe API of which can be considered largely stable, with source breaking changes\nbeing made only upon the release of a new major version.\n\nNewer, experimental, features are implemented and tested on the\n[`v2` branch](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fbenchmark\u002Ftree\u002Fv2). Users who wish\nto use, test, and provide feedback on the new features are encouraged to try\nthis branch. However, this branch provides no stability guarantees and reserves\nthe right to change and break the API at any time.\n\n## Usage\n\n### Basic usage\n\nDefine a function that executes the code to measure, register it as a benchmark\nfunction using the `BENCHMARK` macro, and ensure an appropriate `main` function\nis available:\n\n```c++\n#include \u003Cbenchmark\u002Fbenchmark.h>\n\nstatic void BM_StringCreation(benchmark::State& state) {\n  for (auto _ : state)\n    std::string empty_string;\n}\n\u002F\u002F Register the function as a benchmark\nBENCHMARK(BM_StringCreation);\n\n\u002F\u002F Define another benchmark\nstatic void BM_StringCopy(benchmark::State& state) {\n  std::string x = \"hello\";\n  for (auto _ : state)\n    std::string copy(x);\n}\nBENCHMARK(BM_StringCopy);\n\nBENCHMARK_MAIN();\n```\n\nTo run the benchmark, compile and link against the `benchmark` library\n(libbenchmark.a\u002F.so). If you followed the build steps above, this library will \nbe under the build directory you created.\n\n```bash\n# Example on linux after running the build steps above. Assumes the\n# `benchmark` and `build` directories are under the current directory.\n$ g++ mybenchmark.cc -std=c++11 -isystem benchmark\u002Finclude \\\n  -Lbenchmark\u002Fbuild\u002Fsrc -lbenchmark -lpthread -o mybenchmark\n```\n\nAlternatively, link against the `benchmark_main` library and remove\n`BENCHMARK_MAIN();` above to get the same behavior.\n\nThe compiled executable will run all benchmarks by default. Pass the `--help`\nflag for option information or see the [User Guide](docs\u002Fuser_guide.md).\n\n### Usage with CMake\n\nIf using CMake, it is recommended to link against the project-provided\n`benchmark::benchmark` and `benchmark::benchmark_main` targets using\n`target_link_libraries`.\nIt is possible to use ```find_package``` to import an installed version of the\nlibrary.\n```cmake\nfind_package(benchmark REQUIRED)\n```\nAlternatively, ```add_subdirectory``` will incorporate the library directly in\nto one's CMake project.\n```cmake\nadd_subdirectory(benchmark)\n```\nEither way, link to the library as follows.\n```cmake\ntarget_link_libraries(MyTarget benchmark::benchmark)\n```\n","google\u002Fbenchmark 是一个用于微基准测试的支持库，主要用于评估代码片段的性能。其核心功能是提供了一套类似于单元测试的API来测量代码执行时间，支持C++17标准，并且可以与多种编译器和构建工具兼容。该库特别适合于需要对算法、数据结构或特定函数进行性能优化分析的场景，能够帮助开发者准确地识别出程序中的性能瓶颈。通过简单的接口设计，用户可以方便地定义和运行基准测试，从而在开发过程中持续监控和改进软件性能。",2,"2026-06-11 03:53:06","trending"]