{"id":27180098,"url":"https://github.com/jmarrec/cppbenchmarks","last_synced_at":"2026-05-02T02:38:34.654Z","repository":{"id":88252368,"uuid":"329906910","full_name":"jmarrec/CppBenchmarks","owner":"jmarrec","description":"A collection of some benchmark scripts I used for C++","archived":false,"fork":false,"pushed_at":"2025-04-04T09:05:42.000Z","size":953,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T10:22:46.074Z","etag":null,"topics":["benchmark","c-plus-plus","cmake","conan","cpp","cpp20"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmarrec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-15T12:32:48.000Z","updated_at":"2025-04-04T09:05:46.000Z","dependencies_parsed_at":"2024-08-12T11:47:03.303Z","dependency_job_id":"80f89bc3-3f37-49e6-b138-c4bb5a83251e","html_url":"https://github.com/jmarrec/CppBenchmarks","commit_stats":{"total_commits":61,"total_committers":1,"mean_commits":61.0,"dds":0.0,"last_synced_commit":"951b828fb1fbe0eee8025db94d1f6be2321954f9"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmarrec%2FCppBenchmarks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmarrec%2FCppBenchmarks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmarrec%2FCppBenchmarks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmarrec%2FCppBenchmarks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmarrec","download_url":"https://codeload.github.com/jmarrec/CppBenchmarks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054523,"owners_count":21040020,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","c-plus-plus","cmake","conan","cpp","cpp20"],"created_at":"2025-04-09T14:25:36.038Z","updated_at":"2026-05-02T02:38:34.620Z","avatar_url":"https://github.com/jmarrec.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CppBenchmarks\n\nA collection of some benchmark scripts I used for C++.\n\nThe `CMakeLists.txt` will add some [conan](https://github.com/conan-io/conan) dependencies (such as [Google Benchmark library](https://github.com/google/benchmark)), and do some other magic (enable ccache, etc).\n\nTested with:\n\n* GCC 10.1.0\n* cmake 3.19.2\n* conan 1.32.1\n\nOne executable will be made for each cpp file that starts with `bench`: `bench_\u003cname\u003e.cpp` will create a `build/Products/\u003cname\u003e` executable.\n\nAs usual, you can pass options to the executable:\n\n\nUsing **conan \u003e= 2.0**:\n\nInstall conan dependencies and create toolchain file.\n\n```shell\nconan install . --output-folder=./build --build=missing -c tools.cmake.cmaketoolchain:generator=Ninja -s compiler.cppstd=20 -s build_type=Release\n```\n\nBuild using conan-presets\n\n```shell\ncmake --preset conan-release\ncmake --build --preset conan-release\n```\n\nAlternatively, build explicitly.\n\n```\ncd build/\n. ./conanbuild.sh\ncmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON ../\nninja\n```\n\nUsage:\n\n```\n./Products/bench_basics --benchmark_out=results.csv --benchmark_out_format=csv\n\n./Products/bench_basics --help\nbenchmark [--benchmark_list_tests={true|false}]\n          [--benchmark_filter=\u003cregex\u003e]\n          [--benchmark_min_time=\u003cmin_time\u003e]\n          [--benchmark_repetitions=\u003cnum_repetitions\u003e]\n          [--benchmark_report_aggregates_only={true|false}]\n          [--benchmark_display_aggregates_only={true|false}]\n          [--benchmark_format=\u003cconsole|json|csv\u003e]\n          [--benchmark_out=\u003cfilename\u003e]\n          [--benchmark_out_format=\u003cjson|console|csv\u003e]\n          [--benchmark_color={auto|true|false}]\n          [--benchmark_counters_tabular={true|false}]\n          [--v=\u003cverbosity\u003e]\n```\n\n## Python CLI to plot results\n\nA small utility to run a specific benchmark executable and plot a bar chart of the results.\n\nSee embedded help via `python plot_results.py --help`\n\n```\n# List available benchmark executables. You should have built the project first!\n(py39)julien@CppBenchmarks (main %\u003e)$ python plot_results.py -l\n\nThe following benchmark executables are available:\n* bench_IdfObject_print\n* bench_basics\n\n# Run benchmark and see results\n(py39)julien@CppBenchmarks (main +\u003e)$ python plot_results.py bench_IdfObject_print\n\n2021-01-15T14:50:06+01:00\nRunning /home/julien/Software/CppBenchmarks/build/Products/bench_IdfObject_print\nRun on (12 X 4100 MHz CPU s)\nCPU Caches:\n  L1 Data 32 KiB (x6)\n  L1 Instruction 32 KiB (x6)\n  L2 Unified 256 KiB (x6)\n  L3 Unified 9216 KiB (x1)\nLoad Average: 1.24, 1.25, 1.16\n***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.\n-------------------------------------------------------------\nBenchmark                   Time             CPU   Iterations\n-------------------------------------------------------------\nBM_OutputN             191084 ns       153003 ns         4517\nBM_OutputEndl         1925007 ns      1874790 ns          372\nBM_BoostOutputN        195299 ns       155654 ns         4459\nBM_BoostOutputEndl    2030197 ns      1980846 ns          358\n```\n\nA matplotlib window will pop up with the graph:\n\n![Matplotlib results](images/plot_results.png)\n\n**Alternatively, pass `--stacked`**:\n\n```\n(py39)julien@CppBenchmarks (main +\u003e)$ python plot_results.py --stacked bench_IdfObject_print\n```\n\n![Matplotlib results stacked](images/plot_results_stacked.png)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmarrec%2Fcppbenchmarks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmarrec%2Fcppbenchmarks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmarrec%2Fcppbenchmarks/lists"}