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

Skip Invariant initialization test for CultureData.Invariant #45064

Merged
merged 2 commits into from
Nov 23, 2020

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Nov 22, 2020

It currently goes through an expensive test PopulateIsAsciiCasingSameAsInvariant to check if Invariant is equivalent to Invariant which can be skipped; which shows up in startup (when running ToUpperInvariant for the first time to get the Guid to initialize an ASP.NET EventSource)

Before

image

image

After

image

image

/cc @GrabYourPitchforks

Contributes to #44598

@ghost
Copy link

ghost commented Nov 22, 2020

Tagging subscribers to this area: @tarekgh, @safern, @krwq
See info in area-owners.md if you want to be subscribed.

Issue Details

It currently goes through an expensive test to check if Invariant is equivalent to Invariant which can be skipped; which shows up in startup (when running ToUpperInvariant for the first time to get the Guid to initialize an ASP.NET EventSource)

Before

image

After

image

/cc @GrabYourPitchforks

Author: benaadams
Assignees: -
Labels:

area-System.Globalization

Milestone: -

@ShreyasJejurkar
Copy link
Contributor

Hey @benaadams, are these profiling tools are of VS? Or you are using something else? Just a side question. 😊

@benaadams
Copy link
Member Author

@MCCshreyas dotTrace Timeline viewer; https://www.jetbrains.com/help/profiler/Timeline_Viewer_Concepts.html is good when you want to zoom in to what happened when

@ShreyasJejurkar
Copy link
Contributor

Ohhh very thanks @benaadams for reply. I will get that! Need to find some resources on how to use it effectively! Any suggestions!?

@benaadams
Copy link
Member Author

@MCCshreyas You can do a similar thing with the VS profiler; however the docs for dotTrace in timeline view are here (with gifs, that play if you click them) https://www.jetbrains.com/help/profiler/Get_Started_with_Timeline_Profiling_(Basic).html#subsystems

For looking at the runtime specifically and getting a breakdown for the native methods (including Jit, GC, VM); and then seeing the effect of any changes you'll have to build the runtime (this repo)

.\build -c Release

Then copy the files from
runtime\artifacts\bin\coreclr\windows.x64.Release and the pdb files from runtime\artifacts\bin\coreclr\windows.x64.Release\PDB to an app that you have published selfcontained:

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <PublishReadyToRun>True</PublishReadyToRun>
    <SelfContained>true</SelfContained>
  </PropertyGroup>
dotnet publish -c Release

Note: before each recompile of the runtime you'll have to delete System.Private.CoreLib.ni.pdb from the pdb directory otherwise it will keep appending to the end and not pickup the changes properly #35489

For dotTrace specifically; only the timeline view will give you a breakdown of the native methods (when you include the native runtime pdbs in the apps publish directory); the other modes will only look at the managed code
image

@ShreyasJejurkar
Copy link
Contributor

ohh @benaadams, really thankful for this information. Am currently looking at how I can see method allocations and stuff like that with VS.

I always see yours, @stephentoub, and other people's recent PR on reducing allocations specifically, and you guys are doing a great job. So I always wonder, how you guys are doing this much analysis, so I asked you. I am quite new to this kind of C# and related stuff (like micro-optimization and allocations), seems like it's a lot to learn yet for me.

Really thank you @benaadams, really appreciated it. 🥇

@benaadams
Copy link
Member Author

Am currently looking at how I can see method allocations and stuff like that with VS.

Debug -> Performance Profiler -> .NET Object Allocation Tracking

image

You can also open a dmp file directly in VS that will give you a static view of what is allocated; and can use the dotnet-dump tool to create them https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-dump

@ShreyasJejurkar
Copy link
Contributor

Oh ok, I think I need to install profiling workload to get this in VS, as by default I only have CPU and Memory profiler. I will get this and will explore for sure! Thanks again! 😊

@stephentoub stephentoub merged commit 8861c41 into dotnet:master Nov 23, 2020
@benaadams benaadams deleted the CultureData.Invariant branch November 23, 2020 15:46
@ghost ghost locked as resolved and limited conversation to collaborators Dec 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants