Skip to content

Re-evaluate the need for DependencyPropertyGenerator #18671

Open
@Youssef1313

Description

@Youssef1313

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

[GeneratedDependencyProperty(
, and once without the attribute by declaring the DP in the normal way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/code-generationCategorizes an issue or PR as relevant to code generationarea/performance 📈Categorizes an issue or PR as relevant to performancedifficulty/tbdCategorizes an issue for which the difficulty level needs to be defined.kind/enhancementNew feature or requesttriage/untriagedIndicates an issue requires triaging or verification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions