Skip to content

[perf-improver] Add benchmark coverage for ObjectModelConverters.FixUpTestCase #11395

Description

@github-actions

Tip

Your pull request is ready to create! 🎉 ✅

Everything is OK—the changes have been pushed to branch perf-assist/objectmodelconverters-fixuptestcase-benchmark-v2-17330505996e961e. Please review the changes, including any protected files, before creating the pull request.

Create the pull request

The original pull request description is below.


Goal and rationale

ObjectModelConverters.FixUpTestCase (VSTestBridge) runs once per discovered/executed VSTest TestCase to swap in the platform's executor URI. This is a per-test hot path that was optimized in a prior perf-improver PR (2026-08-13: replaced a LINQ Any(lambda) scan with a manual loop over testCase.GetProperties()), but it had no dedicated benchmark to prevent future regressions or guide further optimization.

Approach

Added ObjectModelConvertersBenchmarks.cs to MSTest.Performance.Benchmarks, wiring up:

  • InternalsVisibleTo from Microsoft.Testing.Extensions.VSTestBridge to MSTest.Performance.Benchmarks (the type under test is internal).
  • A ProjectReference from the benchmarks project to VSTestBridge.
  • A benchmark that constructs a fresh TestCase per iteration (via [IterationSetup], since FixUpTestCase mutates the instance) and measures the call.

Performance evidence

Ran with dotnet run -c Release -- --job short:

Method Mean Allocated
FixUpTestCase ~5.4 us 112 B

The small residual allocation comes from TestCase.SetPropertyValue's dictionary-backed property store, not from the loop itself — a useful baseline for future work in this area.

Trade-offs

None of note — this adds only a benchmark and its wiring (IVT + ProjectReference), no production code changes.

Reproducibility

./build.sh -c Release
cd test/Performance/MSTest.Performance.Benchmarks
dotnet run -c Release --filter "*ObjectModelConverters*" -- --job short

Test Status

  • ./build.sh -c Release: succeeded, 0 warnings/errors.
  • Microsoft.Testing.Extensions.VSTestBridge.UnitTests --filter "FullyQualifiedName~ObjectModelConvertersTests": 25/25 passed.
  • dotnet format whitespace --verify-no-changes on the new file: clean (UTF-8 BOM applied per repo convention).

Note

GitHub Actions is not permitted to create or approve pull requests in this repository.

The changes have been pushed to branch perf-assist/objectmodelconverters-fixuptestcase-benchmark-v2-17330505996e961e and are ready to review.

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (36 of 89 lines)
From eb0b94782720ae65897b40eef3efff9eed5336ba Mon Sep 17 00:00:00 2001
X-GH-AW-Base-Commit: f0fe5a89980d2b29daeb3c949c08d7f61b9cf939
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Sun, 20 Sep 2026 13:43:37 +0000
Subject: [PATCH] Add benchmark coverage for
 ObjectModelConverters.FixUpTestCase

Adds a dedicated BenchmarkDotNet benchmark for
ObjectModelConverters.FixUpTestCase (VSTestBridge), the per-test-case
hot path fixed in a prior perf-improver PR (2026-08-13, replacing an
Any(lambda) LINQ scan with a manual loop). This method previously
lacked measurement coverage.

Measured: 5.4us / 112B alloc per call (short job, .NET 10, Release).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 ...oft.Testing.Extensions.VSTestBridge.csproj |  1 +
 .../MSTest.Performance.Benchmarks.csproj      |  1 +
 .../ObjectModelConvertersBenchmarks.cs        | 32 +++++++++++++++++++
 3 files changed, 34 insertions(+)
 create mode 100644 test/Performance/MSTest.Performance.Benchmarks/ObjectModelConvertersBenchmarks.cs

diff --git a/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Microsoft.Testing.Extensions.VSTestBridge.csproj b/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Microsoft.Testing.Extensions.VSTestBridge.csproj
index 2cb7bf5..5239f88 100644
--- a/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Microsoft.Testing.Extensions.VSTestBridge.csproj
+++ b/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Microsoft.Testing.Extensions.VSTestBridge.csproj
@@ -22,6 +22,7 @@
   <ItemGroup>
     <InternalsVisibleTo Include="MSTest.TestAdapter" Key="$(VsPublicKey)" />
     <InternalsVisibleTo Include="Microsoft.Testing.Extensions.VSTestBridge.UnitTests" Key="$(VsPublicKey)" />
+    <InternalsVisibleTo Include="MSTest.Performance.Benchmarks" Key="$(VsPublicKey)" />
   </ItemGroup>
 
 
diff --git a/test/Performance/MSTest.Performance.Benchmarks/MSTest.Performance.Benchmarks.csproj b/test/Performance/MSTest.Pe
... (truncated)

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • github.com
  • southcentralus0.in.applicationinsights.azure.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"
    - "southcentralus0.in.applicationinsights.azure.com"

See Network Configuration for more information.

🤖 Automated content by GitHub Copilot. Generated by the Perf Improver workflow. · copilot · auto · 346.3 AIC · ⌖ 13.1 AIC · ⊞ 16K · [◷]( · )
Comment /perf-assist to run again

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/perf-improver.md@main

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions