-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Use span for LengthConverter #8622
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/LengthConverter.cs
Show resolved
Hide resolved
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.
Awesome
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/LengthConverter.cs
Show resolved
Hide resolved
...soft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/DataGridLengthConverter.cs
Show resolved
Hide resolved
...osoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XamlGridLengthSerializer.cs
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/LengthConverter.cs
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationFramework/PresentationFramework.csproj
Outdated
Show resolved
Hide resolved
…rter-span # Conflicts: # src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/DataGridLengthConverter.cs
I updated my branch to main to fix a conflict and pushed a commit with the PR feedback. |
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.
Overall the changes looks good. Checked performance gain on multiple applications. There is about 4% gain on performance at xaml reading and it reflects out to be around 2% of gain at LoadComponent
level when averaged out over multiple runs.
Sounds amazing, I can't wait to push a PR benefiting from those changes! 😄 |
@ThomasGoulet73 we have encountered a use case where the following changes are causing a regression. Please find the minimal repro here. A bit of context, and to summarize the failure, the Height specified to Can you please look if we can mitigate this failure. I believe we might need changes in |
Hi @harshit7962, I think I found the problem. Here it should've been I looked at my other changes and they all use I'll test to make sure it fixes your repro later today. |
@harshit7962: I was able to reproduce the issue using your minimal repro and I have confirmed that the suspected fix in my previous comment did fix the issue. Thank you for the simple repro! |
@ThomasGoulet73 verified that the edge case is fixed with the change. Thank you for your contributions. |
Thanks @harshit7962 |
Description
Use span for LengthConverter and other similar places. I also introduced the internal struct
PixelUnit
to share some of the logic.I found that LengthConverter.FromString can be called a lot on startup (~3000 times in a sample app).
Benchmark
Customer Impact
Better perf and lower memory usage.
Regression
No.
Testing
Local testing.
Risk
Low.
Microsoft Reviewers: Open in CodeFlow