-
Notifications
You must be signed in to change notification settings - Fork 1.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
IndexOfAny/ProbablyContains/InitializeProbabilisticMap is showing up on radar #2411
Comments
Feel free to assign this one to me. |
// If there are no substitutions, then just return the string.
propertyStartIndex = s_invariantCompareInfo.IndexOf(expression, "$(", CompareOptions.Ordinal);
if (propertyStartIndex == -1)
{
return expression;
} |
I don't know what the cause of this is, I replaced all usage of IndexOfAny and LastIndexOfAny and it's still showing up on the radar. |
together amount to ~0.4% of evaluation time according to recent @arkalyanms's traces. ProbablyContains and InitializeProbabilisticMap have broken stacks and IndexOfCharArray (~0.2% of eval time) has many callers with nothing standing out: Based on this I'm inclined to close this unless @davkean remembers the scenario where the excessive cost was observed. |
I have seen popup in a few traces recently as much as what caused me to file the original CoreFx bug but the traces are long gone. I will keep an eye out for it and reopen this if you close it if I see it again. |
See: https://github.com/dotnet/corefx/issues/22771
I've looked at 3 large solutions where IndexOfAny usage is showing up on the radar. I initially thought that it maybe caused by Directory.GetFiles/GetDirectories usage (where they check for invalid chars) but looking at this trace: #2348, I see it consuming a lot (25% of CPU) - but very little time spent in GetFiles/GetDirectories.
Check usage of other Path APIs, such as GetExtension which also does a invalid char check - it may be caused by this.
I suspect we should just hand write IndexOfAny checks for known chars.
The text was updated successfully, but these errors were encountered: