Skip to content

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

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-c54b6061feb1bbb0. 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 VSTest TestCase during discovery/execution — a genuine per-test hot path for every VSTest-driven run through this bridge. It was previously optimized (2026-08-13, avoiding a LINQ Any(lambda) delegate allocation) but had no dedicated benchmark to guard against future regressions or to serve as a baseline for further optimization.

Approach

  • Added InternalsVisibleTo for MSTest.Performance.Benchmarks to Microsoft.Testing.Extensions.VSTestBridge.csproj (matching the existing IVT pattern already used for TestFramework/MSTest.TestAdapter/MSTestAdapter.PlatformServices).
  • Added a ProjectReference to VSTestBridge from the benchmarks project.
  • Added ObjectModelConvertersBenchmarks.cs, measuring FixUpTestCase on a freshly-constructed TestCase per iteration (via [IterationSetup], since the method mutates the instance).

Performance evidence

Ran via dotnet <benchmarks-dll> --filter "*ObjectModelConverters*" --job short (BenchmarkDotNet, .NET 10, Linux sandbox):

Method Mean Allocated
FixUpTestCase 4.626 μs 112 B

This establishes a baseline; the small residual allocation comes from TestCase.SetPropertyValue's dictionary-backed property store, which is out of scope for this change.

Trade-offs

None expected — this is additive benchmark/test-infrastructure code, not a runtime behavior change. No new production dependencies.

Reproducibility

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

Test Status

  • ./build.sh -c Release succeeded (0 warnings, 0 errors).
  • Microsoft.Testing.Extensions.VSTestBridge.UnitTests filtered to ObjectModelConvertersTests (--filter "FullyQualifiedName~ObjectModelConvertersTests"): 25/25 passed.
  • dotnet format --verify-no-changes clean for changed files.

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-c54b6061feb1bbb0 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 (37 of 87 lines)
From b3cc00256aaf056893f1fc8c503a6198341dd022 Mon Sep 17 00:00:00 2001
X-GH-AW-Base-Commit: 00b4e2a445a42b8768fdd706e7de778e582fb034
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 18 Sep 2026 13:50:28 +0000
Subject: [PATCH] Add benchmark coverage for
 ObjectModelConverters.FixUpTestCase

FixUpTestCase runs once per VSTest TestCase discovered/executed through
the VSTestBridge (a genuine per-test hot path), and previously had no
dedicated benchmark despite the LINQ-allocation fix made to it earlier.

Adds InternalsVisibleTo from VSTestBridge to MSTest.Performance.Benchmarks
and a ProjectReference to VSTestBridge in the benchmarks project, plus
ObjectModelConvertersBenchmarks.cs measuring FixUpTestCase on a
freshly-constructed TestCase per iteration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 ...oft.Testing.Extensions.VSTestBridge.csproj |  1 +
 .../MSTest.Performance.Benchmarks.csproj      |  1 +
 .../ObjectModelConvertersBenchmarks.cs        | 29 +++++++++++++++++++
 3 files changed, 31 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 --
... (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 · 276.2 AIC · ⌖ 9.86 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