Re-evaluate the need for DependencyPropertyGenerator #18671
Labels
area/code-generation
Categorizes an issue or PR as relevant to code generation
area/performance 📈
Categorizes an issue or PR as relevant to performance
difficulty/tbd
Categorizes an issue for which the difficulty level needs to be defined.
kind/enhancement
New feature or request
triage/untriaged
Indicates an issue requires triaging or verification
What would you like to be added
The internal DependencyPropertyGenerator was originally designed and intended to sacrifice extra memory use in the DependencyObject for a super super fast DP reads. The read through the generator is basically just a backing field read.
Now, with the all the recent DP system performance improvements, it's likely that the regular DP reads are fast enough to not cause any trouble. In that case, it means the generator just adds more memory pressure without much performance benefits.
The performance should be re-evaluated to see if the generator is still needed, or if it's only an overhead without a benefit.
My guess is that now the DP reads should be fast enough that the generator shouldn't be needed.
Extra note: If we need the generator to avoid the boilerplate for declaring DPs, we should then change the way the code is generated to be just like any regular DP.
Why is this needed
Cleanup + Performance
For which platform
All
Anything else we need to know?
The relevant benchmarks are in https://github.com/unoplatform/uno/blob/master/src/SamplesApp/Benchmarks.Shared/Suite/Windows_UI_Xaml_Controls/DependencyPropertyBench/SimpleDPBenchmark.cs
The outcome of the benchmarks at the time of implementing the generator is documented in https://github.com/unoplatform/uno/blob/3304465bbae63aab228cde20365157c74390aa76/doc/articles/uno-development/Internal-DependencyProperty-Generator.md
Those benchmarks are run against FrameworkElement.Width DP. So, we need to run the benchmarks twice. Once with the GeneratedDependencyProperty attribute here
uno/src/Uno.UI/UI/Xaml/FrameworkElement.crossruntime.cs
Line 73 in df20ef5
The text was updated successfully, but these errors were encountered: