Repository navigation
Benchmark MCP protocol helpers - #3031
HarshPopat23 wants to merge 2 commits into
Conversation
Add gated MCP benchmarks for parsed metadata, separate JSON parsing, header mirroring, result writers and subscription intersection. Include Release-active fixture controls and reproducible measurement instructions. Signed-off-by: HarshPopat23 <musichk61@gmail.com>
There was a problem hiding this comment.
2 issues found across 3 files
You’re at about 90% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="benchmark/MCP.markdown">
<violation number="1" location="benchmark/MCP.markdown:18">
P3: The executable path is wrong on Windows: CMake places it under `build/bin`, not `build/benchmark`. Document the platform-specific path alongside the multi-configuration path.</violation>
<violation number="2" location="benchmark/MCP.markdown:25">
P3: The mimalloc comparison only applies on Linux/macOS builds without sanitizers. Add that qualifier here so readers do not run an OFF build expecting mimalloc on Windows or sanitizer builds.</violation>
</file>
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Re-trigger cubic
| `cmake -LA -N build` output, compiler/version (`c++ --version` or the platform | ||
| compiler equivalent), CPU/OS, build configuration, SIMD flags, and system load. | ||
| The command above explicitly selects the system allocator. Repeat in a separate | ||
| build with `SOURCEMETA_CORE_USE_SYSTEM_ALLOCATOR=OFF` to study the configured |
There was a problem hiding this comment.
P3: The mimalloc comparison only applies on Linux/macOS builds without sanitizers. Add that qualifier here so readers do not run an OFF build expecting mimalloc on Windows or sanitizer builds.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At benchmark/MCP.markdown, line 25:
<comment>The mimalloc comparison only applies on Linux/macOS builds without sanitizers. Add that qualifier here so readers do not run an OFF build expecting mimalloc on Windows or sanitizer builds.</comment>
<file context>
@@ -0,0 +1,76 @@
+`cmake -LA -N build` output, compiler/version (`c++ --version` or the platform
+compiler equivalent), CPU/OS, build configuration, SIMD flags, and system load.
+The command above explicitly selects the system allocator. Repeat in a separate
+build with `SOURCEMETA_CORE_USE_SYSTEM_ALLOCATOR=OFF` to study the configured
+mimalloc allocator; do not mix allocator/build/compiler results. The harness
+JSON records timings and core count, not all of this environment information.
</file context>
| build with `SOURCEMETA_CORE_USE_SYSTEM_ALLOCATOR=OFF` to study the configured | |
| build with `SOURCEMETA_CORE_USE_SYSTEM_ALLOCATOR=OFF` to study the configured | |
| (Linux/macOS, non-sanitizer builds only; elsewhere OFF uses the system allocator too) |
| -DSOURCEMETA_CORE_USE_SYSTEM_ALLOCATOR=ON | ||
| cmake --build build --config Release --target sourcemeta_core_benchmarks | ||
| # Single-configuration generators; multi-configuration builds may add Release/ | ||
| ./build/benchmark/sourcemeta_core_benchmarks --filter MCP_ --output build/mcp.json |
There was a problem hiding this comment.
P3: The executable path is wrong on Windows: CMake places it under build/bin, not build/benchmark. Document the platform-specific path alongside the multi-configuration path.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At benchmark/MCP.markdown, line 18:
<comment>The executable path is wrong on Windows: CMake places it under `build/bin`, not `build/benchmark`. Document the platform-specific path alongside the multi-configuration path.</comment>
<file context>
@@ -0,0 +1,76 @@
+ -DSOURCEMETA_CORE_USE_SYSTEM_ALLOCATOR=ON
+cmake --build build --config Release --target sourcemeta_core_benchmarks
+# Single-configuration generators; multi-configuration builds may add Release/
+./build/benchmark/sourcemeta_core_benchmarks --filter MCP_ --output build/mcp.json
+```
+
</file context>
🤖 Augment PR SummarySummary: Establishes reproducible performance baselines for MCP protocol helpers.
🤖 Was this summary useful? React with 👍 or 👎 |
Use a designated parameter descriptor initializer and make arithmetic precedence explicit for the macOS LLVM warnings-as-errors build. Signed-off-by: HarshPopat23 <musichk61@gmail.com>
Use descriptive comparator parameter names for readability-identifier-length. Carry the existing sourcemeta#3031 benchmark lint fixes onto this dependent branch: designated descriptor initialization and explicit arithmetic grouping. No validation or benchmark behavior changes. Signed-off-by: HarshPopat23 <musichk61@gmail.com>
Summary
The benchmark harness currently has no dedicated MCP cases. This PR establishes reproducible baselines for metadata validation, header mirroring, result serialization and subscription intersection, so future optimizations can be evaluated against consistent workloads.
Adds 22 deterministic microbenchmarks, registered and linked only when
SOURCEMETA_CORE_MCPis enabled. No production APIs or validation behavior change.Benchmark coverage
Area | Workloads -- | -- JSON parsing | Parse cached metadata envelopes with 0 and 128 additional metadata keys, separately from MCP validation Metadata validation | Validate already parsed requests, including valid inputs and invalid progress tokens Header mirroring | Generate and validate headers with 2 and 64 descriptors, including Unicode sentinel encoding, unrelated headers and late mismatches Result serialization | Serialize 1 and 256 resources through const-input and move-taking writers; measure invalid-result rejection separately Subscription intersection | Intersect overlapping and disjoint lists containing 8 and 512 URIs per sideMeasurement boundaries
Fixture construction and preflight correctness checks occur outside timed loops.
Preflight checks remain active in Release builds.
Results use the existing benchmark optimization barrier.
Per-iteration output allocation and destruction are included.
The move-writer benchmark explicitly includes the fresh-payload copy required for each repetition. It is labelled copy + move-write, rather than implying a copy-free comparison.
Parsing, successful validation, rejection and serialization have distinct benchmark names.
benchmark/MCP.markdowndocuments fixture sizes, timing boundaries, execution commands and the compiler, build, allocator and machine information needed for reproducible comparisons.Files changed
benchmark/CMakeLists.txt-conditional MCP benchmark registration and linkage.benchmark/mcp.cc- workloads and Release-active correctness controls.benchmark/MCP.markdown- measurement and reproduction instructions.Verification
Release build passed with GCC 13.3 and the system allocator.
All 22 filtered MCP benchmarks completed successfully.
JSON output verified for unique registrations, finite positive timings and three repetitions.
Existing MCP unit suite: 1,420 passed, zero failed.
MCP-disabled configuration verified to exclude
benchmark/mcp.cc.Repository clang-format checks and
git diff --checkpassed.Limitations
These are authored microbenchmark fixtures, not captured production traffic. They measure local helper operations, not model generation, network latency or a complete MCP transport runtime.
This PR establishes baselines; it makes no speedup claim and introduces no CI timing thresholds. Allocation profiling, the full repository test matrix and Windows/macOS builds were not run locally.