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

[graphics] fix CA1307 and CA1309 for performance #14627

Merged
merged 1 commit into from Apr 18, 2023

Commits on Apr 17, 2023

  1. [graphics] fix CA1307 and CA1309 for performance

    Context: dotnet#12130
    Context: https://github.com/angelru/CvSlowJittering
    
    While reviewing the above sample, I saw time spent doing culture-aware
    string "stuff" in Microsoft.Maui.Graphics:
    
        77.22ms microsoft.maui!Microsoft.Maui.Graphics.MauiDrawable.SetDefaultBackgroundColor()
        42.55ms System.Private.CoreLib!System.String.ToLower()
    
    In c40c6e7, I added code analysis rules to the `.editorconfig`, but
    it appears we ignored these warnings in dbaeee9.
    
    These are generally easy to fix, we should have just addressed these
    instead of adding `$(NoWarn)`.
    
    In the future, I will look into adding `CA1311`:
    
    https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1311
    
    This would find `string.ToLower()` calls and recommend
    `string.ToLowerInvariant()` instead. I fixed the one place I saw it
    affecting performance in `dotnet-trace`.
    jonathanpeppers committed Apr 17, 2023
    Configuration menu
    Copy the full SHA
    0af580a View commit details
    Browse the repository at this point in the history