Skip to content

fix: Drop the anonymous namespace from the benchmark URI - #56

Open
chfast wants to merge 1 commit into
CodSpeedHQ:mainfrom
chfast:fix/anonymous-namespace
Open

fix: Drop the anonymous namespace from the benchmark URI#56
chfast wants to merge 1 commit into
CodSpeedHQ:mainfrom
chfast:fix/anonymous-namespace

Conversation

@chfast

@chfast chfast commented Aug 14, 2026

Copy link
Copy Markdown

Related to #40.

extract_lambda_namespace() rejects a namespace containing (anonymous namespace), which is how clang spells it, but GCC spells it {anonymous} and that spelling passes the check unnoticed. The benchmarks registered inside an anonymous namespace therefore end up reported as file.cpp::{anonymous}::bench[…] with GCC, and as file.cpp::bench[…] plus an [ERROR] Anonymous namespace not supported line per benchmark with clang.

Since an anonymous namespace is not part of any identifier a benchmark can be referred to by, this strips the segment instead of bailing out, handling both spellings. The rest of the namespace path is preserved, so {anonymous}::outer:: becomes outer::, and nothing is reported for a construct that is merely unnameable rather than unsupported.

The namespace was extracted from __PRETTY_FUNCTION__ and rejected only when
spelled '(anonymous namespace)', as clang does, so with GCC, which spells it
'{anonymous}', it ended up in the URI: file.cpp::{anonymous}::bench[…]. Strip the
segment instead of bailing out, for both spellings, so the rest of the namespace
path is kept and no error is reported for a construct that is merely unnameable.
@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown

Greptile Summary

This PR normalizes benchmark namespace extraction across GCC and Clang by removing compiler-specific anonymous-namespace segments instead of rejecting them.

  • Adds a helper that removes both GCC and Clang anonymous-namespace spellings.
  • Applies normalization after compiler-specific namespace extraction.
  • Removes the obsolete error output and <iostream> dependency.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

The normalization removes only compiler-generated strings that cannot be valid C++ namespace identifiers, while retaining the source-file and named-namespace portions used to identify benchmarks.

Important Files Changed

Filename Overview
core/src/uri.cpp Anonymous namespace markers are consistently removed while preserving source-file and named-namespace components of benchmark URIs.

Reviews (1): Last reviewed commit: "fix: Drop the anonymous namespace from t..." | Re-trigger Greptile

chfast added a commit to ipsilon/evmone that referenced this pull request Aug 16, 2026
Reports the benchmark results for every pull request, measured with CPU
simulation so that they are comparable despite running on the shared
GitHub runners.

`test/CMakeLists.txt` fetches either google/benchmark or, when
`CODSPEED_MODE` is set, CodSpeed's compatibility layer providing the
same `benchmark::benchmark` target. The layer temporarily comes from a
fork with two fixes not yet upstream: without CodSpeedHQ/codspeed-cpp#55
the `KeepRunningBatch()` loops are executed but never measured, silently
dropping every precompile benchmark, and without
CodSpeedHQ/codspeed-cpp#56 the anonymous namespace ends up in the
reported URIs. On the benchmark side only `bench_name()` is added,
giving the dynamically registered benchmarks the `file::name` URI the
`BENCHMARK()` macro provides on its own.

129 benchmarks are reported: the baseline VM on the mainnet-derived
programs (41) and all the precompile cases (88), including the modexp
parameter sweep and the GMP and libsecp256k1 implementations. The
synthetic benchmarks, the `advanced` and `bnocgoto` VM variants and the
internal benchmarks are left out.

---------

Co-authored-by: Paweł Bylica <pawel@hepcolgum.band>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant