Skip to content

Deoptimize the exceptional cases in favor of optimal path #62997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2025

Conversation

lewing
Copy link
Member

@lewing lewing commented Jul 29, 2025

Avoid an extra lookup in the fastpath at the expense of potentially a lot of work

@lewing
Copy link
Member Author

lewing commented Aug 6, 2025

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@lewing lewing marked this pull request as ready for review August 6, 2025 15:29
@Copilot Copilot AI review requested due to automatic review settings August 6, 2025 15:29
@lewing lewing requested a review from a team as a code owner August 6, 2025 15:29
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes the state persistence flow by eliminating redundant dictionary lookups in the success path. Instead of checking for key existence with ContainsKey followed by Add, it directly uses TryAdd which atomically checks and adds the key-value pair.

  • Replaces the two-step ContainsKey + Add pattern with single TryAdd operations
  • Reduces dictionary lookups from two to one in the success path
  • Maintains the same exception behavior for duplicate keys

@javiercn
Copy link
Member

/azp run aspnetcore-always-green

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@lewing lewing closed this Aug 14, 2025
@lewing lewing reopened this Aug 14, 2025
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-rc1 milestone Aug 14, 2025
@lewing lewing enabled auto-merge (squash) August 14, 2025 20:51
@lewing
Copy link
Member Author

lewing commented Aug 15, 2025

/ba-g failure is not from recent build

@lewing lewing merged commit 547ab9e into dotnet:main Aug 15, 2025
32 checks passed
@lewing lewing deleted the doptimize-exceptions branch August 15, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants