FeaturesBlogDocsPricingExploreChangelog
Login
Get Started

Changelog

New updates and improvements released to Codspeed.
Follow us on

May 6, 2025
C++

First Class Bazel Support for C++

First Class Bazel Support for C++

You can now use CodSpeed with Bazel build systems thanks to our enhanced C++ integration!

This addition complements our existing CMake support, making it easier to benchmark large-scale C++ projects with complex build configurations. Bazel support is particularly valuable for enterprise teams working with monorepos and sophisticated dependency management.

Quick Start

Add CodSpeed to your Bazel workspace by adding this to your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "codspeed_cpp",
    urls = ["https://github.com/CodSpeedHQ/codspeed-cpp/archive/refs/heads/main.zip"],
    strip_prefix = "codspeed-cpp-main",
)

Then define your benchmark target in your package's BUILD.bazel file:

cc_binary(
    name = "my_benchmark",
    srcs = glob(["*.cpp", "*.hpp"]),
    deps = [
        "@codspeed_cpp//google_benchmark:benchmark",
    ],
)

Running Benchmarks

Build and run your benchmarks with the CodSpeed instrumentation flag:

# Build your benchmark
bazel build //path/to/bench:my_benchmark --@codspeed_cpp//core:codspeed_mode=instrumentation

# Run it locally
bazel run //path/to/bench:my_benchmark --@codspeed_cpp//core:codspeed_mode=instrumentation

For more information, check out the Bazel section of C++ documentation.

Stop Guessing,
Start Measuring.

Resources Home PricingDocs BlogGitHub Changelog Advent 🎄

{176023}Analyzed Commits
Explore Repos

Backed by
Copyright © 2025 CodSpeed Technology