Google 基准测试:“***警告*** 库是作为 DEBUG 构建的。计时可能会受到影响。”

Google Benchmark: "***WARNING*** Library was built as DEBUG. Timings may be affected."

~/install/benchmark 中,我查看了 Google 基准 (https://github.com/google/benchmark) and built it in Release mode according to the instructions here.

~/personal-projects/benchmarking 中,我有自己的代码,其中包含一个 BUILD 文件和一个 WORKSPACE 文件。在 WORKSPACE 文件中,我有

local_repository(
    name = "com_google_benchmark",
    path = "../../install/benchmark",
)

BUILD 文件中,我有

cc_binary(
    name = "fast_inverse_sqr_root",
    srcs = ["fast_inverse_sqr_root.cpp"],
    deps = [
        "@com_google_benchmark//:benchmark_main",
    ],
)

当我bazel run //fast_inverse_sqr_root时,它说:***WARNING*** Library was built as DEBUG. Timings may be affected.

我找到了 this 相关问题,但是那个人在使用 cmake 而我正在使用 Bazel 构建我的代码。我不确定这里发生了什么。为什么说库是作为 DEBUG 构建的?

尝试让 Bazel 在优化模式下编译所有内容:bazel run -c opt //fast_inverse_sqr_root