-
Notifications
You must be signed in to change notification settings - Fork 698
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
Performance issue - Subscribing\Unsubscribing to events #3557
Comments
@alexserov WinUI3 is more similar to UWP XAML than WPF. Are you seeing similar behavior in an app built off of inbox XAML? |
Hello @chrisglein , I've just measured my tests for UWP XAML and WinUI3 (Preview2) for UWP, and here are the results:
The code is the same for every project. You can find it in my attachment to the original post. As I mentioned earlier, my main interest is in cases 5 and 6 (WinUI for Win32) since we experience the same performance issue in our application. upd: we have our custom controls in the app; they mostly derive from public BaseControl() {
LayoutUpdated += OnLayoutUpdated;
Loaded += OnLoaded;
Unloaded += OnUnloaded;
IsEnabledChanged += OnIsEnabledChanged;
} Since we reuse our code from our UWP project, I expect the performance should be the same or even better. Unfortunately, it is not. |
I've updated my initial post with the measurements for the WinUI3 Preview3. I see the progress; however, the issue still exists.
|
Thanks for the extra data, we really appreciate it. For what it's worth this isn't necessarily true:
WinUI3 isn't guaranteed to have the same performance profile as UWP XAML. There are places where it may be better, places where it'll be worse, and places where it is the same. But moving the platform out of the OS into separate infrastructure will cause changes. We're working on measuring this and working to make those differences minimal/positive, but it will take time. |
One addition to the stack in this case is going to be CsWinRT. There's still analysis of that happening elsewhere, which could uncover potential improvements with events specifically (e.g. this issue) |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Describe the bug
When profiling our test application, we've seen that every event subscription takes a noticeable time.
In our case, this slows down the application startup for about 200ms.
I made a small sample that shows the issue. I've also prepared the WPF test application so you can compare performance.
Steps to reproduce the bug
Steps to reproduce the behavior:
In the table below, you can see the difference between WPF and WinUI performance when subscribing\unsibscribing to the
IsEnabledChanged
event.I've also tried the
Loaded
and theKeyDown
event and got the same results.WinUI pre-202626923365336326Expected behavior
I expect that cases 5 and 6 should be instant (like in WPF) since this is very close to a real scenario: in our app, we have lots of controls with subscriptions to such events as
Loaded
,Unloaded
,IsEnabledChanged
,LayoutUpdated
.I'm also surprised at the poor performance of scenario 4; however, I understand that this is synthetic and may not exist in the real application.
Version Info
NuGet package version:
[Microsoft.WinUI 3.0.0-preview2.200713.0][Microsoft.WinUI 3.0.0-preview3.201113.0]
Windows app type:
Additional context
FrameworkEventsTest.zip
The text was updated successfully, but these errors were encountered: