-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Cache delegates created from static methods #19452
Conversation
@@ -1853,7 +1853,7 @@ private bool ScanIdentifier_SlowPath(ref TokenInfo info) | |||
Debug.Assert(string.Equals(info.Text.Substring(0, objectAddressOffset + 1), "@0x", StringComparison.OrdinalIgnoreCase)); | |||
var valueText = TextWindow.Intern(_identBuffer, objectAddressOffset, _identLen - objectAddressOffset); | |||
// Verify valid hex value. | |||
if ((valueText.Length == 0) || !valueText.All(IsValidHexDigit)) | |||
if ((valueText.Length == 0) || !valueText.All(s_isValidHexDigit)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jasonmalinowski You asked me what my favorite one was. This is it. 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Jason pointed out that this only occurs for the special debugger syntax @0xdeadf00d
(basically an address starting with @0x
, where the @
is not optional).
@@ -20,12 +23,12 @@ public static ArgumentSyntax GenerateArgument(SyntaxNode argument) | |||
|
|||
public static ArgumentListSyntax GenerateArgumentList(IList<SyntaxNode> arguments) | |||
{ | |||
return SyntaxFactory.ArgumentList(SyntaxFactory.SeparatedList(arguments.Select(GenerateArgument))); | |||
return SyntaxFactory.ArgumentList(SyntaxFactory.SeparatedList(arguments.Select(s_generateArgument))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you seeing these allocations in any traces? I'm not a fan of cluttering the code in this fashion if it's not in a hotpath.
@@ -70,11 +70,11 @@ private IEnumerable<string> ApplyCapitalization(IEnumerable<string> words) | |||
switch (CapitalizationScheme) | |||
{ | |||
case Capitalization.PascalCase: | |||
return words.Select(CapitalizeFirstLetter); | |||
return words.Select(s_capitalizeFirstLetter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were intentionally not changed when i did the perf pass for Naming. The expensive hotpaths are in analysis. This was a codepath that was only hit when you needed to actually fix a name. And as such having an allocation here was fine. After all, we're already going to get another allocation from the .Select itself.
THere are codepaths where being alloc-free (or close thereof) is really important. I'd prefer we spend our efforts there.
Ask Mode not yet complete
Customer scenario
What does the customer do to get into this situation, and why do we think this
is common enough to address for this release. (Granted, sometimes this will be
obvious "Open project, VS crashes" but in general, I need to understand how
common a scenario is)
Bugs this fixes:
(either VSO or GitHub links)
Workarounds, if any
Also, why we think they are insufficient for RC vs. RC2, RC3, or RTW
Risk
Typically this is a low-risk change. If a regression occurs, it will almost certainly lie in one of the following:
Performance impact
(with a brief justification for that assessment (e.g. "Low perf impact because no extra allocations/no complexity changes" vs. "Low")
Is this a regression from a previous update?
Root cause analysis:
How did we miss it? What tests are we adding to guard against it in the future?
How was the bug found?
(E.g. customer reported it vs. ad hoc testing)