Conversation
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Create comprehensive performance profiling automation for xUnit
Add automated performance profiling suite for xUnit Assert.Equal compilation issue (#18807)
Nov 11, 2025
…t.Equal test run Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
… path details Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Copilot
AI
changed the title
Add automated performance profiling suite for xUnit Assert.Equal compilation issue (#18807)
Add automated performance profiling suite with trace analysis for xUnit Assert.Equal compilation issue (#18807)
Nov 11, 2025
T-Gro
reviewed
Nov 11, 2025
…avior Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
… rejected Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Contributor
❗ Release notes required
Warning No PR link found in some release notes, please consider adding it.
|
…mprovement Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Contributor
Author
Added release notes entry to
|
T-Gro
reviewed
Feb 11, 2026
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Copilot
AI
changed the title
Cache overload resolution results for repeated method calls
Cache overload resolution results for repeated method calls (preview language feature)
Feb 11, 2026
…utionCache.fs The MethodOverloadsCache language feature check added in commit 6333f49 uses LanguageFeature.MethodOverloadsCache but the module was missing the required open FSharp.Compiler.Features import, causing FS0039 across all CI jobs.
…lease note - PERF: Change cache key fields from list to array (better cache locality, no Seq.toList) - PERF: Pre-compute retTyOpt and anyHasOutArgs once in ResolveOverloading, pass through to avoid redundant List.exists calls - HONEST-ASSESSMENT: Fix test name '95 percent' to match actual 70% assertion threshold - NO-LEFTOVERS: Restore accidentally removed TFM centralization release note entry
PERF: Replace heap-allocated tuples in computeMethInfoHash with combineHash. CODE_QUALITY: Remove pass-through wrappers, deduplicate 5 identical ResolveOverloadingCore calls into single fallthrough path. TEST_COVERAGE: Use parseAndCheckScriptPreview so cache is actually exercised. TEST_CODE_QUALITY: Parameterize 9 identical tests into Theory, remove printfn. NO_LEFTOVERS: Remove redundant inline comments.
…, clean up redundant comments - Removed retTyOpt, anyHasOutArgs, cacheKeyOpt, cache params from GetMostApplicableOverload - Moved storeCacheResult call to caller site in ResolveOverloadingCore - Removed 4 redundant inline comments from test files
- Remove unused _trace parameter from ResolveOverloadingCore - Remove CachedFailed variant (stored but never consumed on lookup) - Clean up redundant comments across compiler and test files - Condense verbose XML doc comments on internal members
- Add missing featureMethodOverloadsCache entry to all 13 XLF translation files (FSComp.txt was modified in 6333f49 but XLF was never updated) - Fix fantomas formatting in OverloadResolutionCache.fs/.fsi and Caches.fs - Add Language preview release note for MethodOverloadsCache feature
abonie
approved these changes
Feb 18, 2026
This was referenced Feb 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Performance
Measured on 5000
Assert.Equal(x, y)calls where x and y are let-bound integers:Typecheck Phase Duration
Speedup: 2.2x faster than .NET 10 SDK, 14x faster than .NET 9 SDK
GC Pressure Reduction
GC0 collections reduced by 82%
Cache Statistics
Why
Overload resolution is expensive. When the same overloaded method is called repeatedly with the same argument types (common in test files with
Assert.Equal), the compiler redundantly recomputes the same resolution.Strategy
Cache the resolution result using a composite key:
When the same key is seen again, return the cached winner index.
Handling Type Stability
TypeHashing generates a
TypeStructurefor each type, which can be:StableUnstable(solved typars)Unstable(unsolved typars)PossiblyInfiniteWhy Solved Typars Are Safe to Cache
When TypeHashing encounters a solved typar (e.g.,
'asolved toint), it:int), not the typar itselfUnstable(becauseTrace.Undocould theoretically revert it)However, in overload resolution context, this is safe because:
FilterEachThenUndorunsWe reject
Unstablestructures only when they containTypeToken.Unsolved- these are flexible typars that could resolve to different types in different contexts.Before/After Key Strategy
To maximize cache hits:
This allows future calls with already-solved types to hit the cache directly.
Safety Constraints
Caching is disabled for:
op_Explicit/op_ImplicitconversionsLanguage Feature Gating
The caching optimization is gated behind a new
MethodOverloadsCachelanguage feature:--langversion:previewWhen the language feature is not supported:
This provides a safe rollout path for testing the optimization before enabling it by default in a future F# release.
Code Organization
Cache logic is isolated in a dedicated module
OverloadResolutionCache.fs:OverloadResolutionCacheKey- cache key type with method hash and type structurestryComputeOverloadCacheKey- key computation with stability checksstoreCacheResult- stores under before/after keys for maximum cache hits (respects language feature)hasUnsolvedTokens- detects flexible typars that must not be cachedTypeHashing.fs is unchanged from main branch (only
MaxTokenCount = 256constant extracted).Testing
67 E2E tests verify correct overload selection (not just compilation):
Each test returns a string identifying which overload was picked, verified at runtime.
All tests use
withLangVersionPreviewto enable theMethodOverloadsCachefeature.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.