Closed sylveon closed 4 months ago
Reälly reminds me of those StructHelper types, which offered often basic functionality, doäble by yourself, with much greater overhead.
I approve replacing PropertyValue.Create* methods! That said, can we finally get useful interfaces like IStringable implemented on boxed objects?
As I recall, the PropertyValue
implementations offer marshal-by-value semantics which the C++/WinRT fallback does not. This is/was required for some APIs depending on boxing. We can't change this now without the risk of breaking such callers. In practice, it's mostly only interesting to Xaml but there are other APIs that depend on this.
marshal-by-value semantics
@kennykerr Can't we implement this ourselves?
From a cursory search, CsWinRT seems to allocate its own IReference (which works fine with XAML).
This issue is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Version
2.0.240405.15
Summary
This takes 30ms to execute:
This takes 8ms to execute:
It seems weird for
box_value
to be using PropertyValue.CreateInt32 when just directly allocating a wrapper is significantly faster.Reproducible example
Expected behavior
I expected boxing to be fast.
Actual behavior
It's kinda slow.
Additional comments
Spotted this while looking into https://github.com/microsoft/microsoft-ui-xaml/discussions/9154
WPF users are expecting WinUI 3 to match WPF performance - and setting 200k DPs takes 21ms with WPF, but 130ms with WinUI 3. We ought to try and match that speed where possible, and this should help by cutting middlemans, at least in C++.