Skip to content
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

A possible opportunity for optimization in ImmutableArrayExtensions.GetTypesFromMemberMap #67991

Closed
AlekseyTs opened this issue Apr 26, 2023 · 1 comment · Fixed by #67997
Closed
Assignees
Labels
Area-Compilers Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality
Milestone

Comments

@AlekseyTs
Copy link
Contributor

bool hasType = false;
bool hasNamespace = false;
foreach (var symbol in members)
{
if (symbol is TNamedTypeSymbol)
{
hasType = true;
if (hasNamespace)
{
break;
}
}
else
{
#if DEBUG
Debug.Assert(symbol is TNamespaceSymbol);
#endif
hasNamespace = true;
if (hasType)
{
break;
}
}
}

It looks like members.As<TNamedTypeSymbol>() can be used to quickly detect a situation when hasType is true && hasNamespace is false

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Apr 26, 2023
@jcouv jcouv added Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 28, 2023
@jcouv jcouv added this to the 17.7 milestone Apr 28, 2023
@jcouv
Copy link
Member

jcouv commented Apr 28, 2023

Assigned to @CyrusNajmabadi since he already has a fix in the works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants