-
Notifications
You must be signed in to change notification settings - Fork 668
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
Navigation and render performance is slow #2032
Comments
Are your issues exclusive to datagrid? If so it might be more appropriate to open an issue on their repository: https://github.com/windows-toolkit/WindowsCommunityToolkit. Performance could likely be impoved on that control. My understanding is that it was a rather targeted addition and could maybe use some further optimization. @RBrid for FYI. |
No, the issue happens when you have a page with a big visual tree, I've created the sample app using the DataGrid to show you easily the real scenario where we need to deal with big visual trees. If you change the DataGrid with a any other big visual tree you will get the same behavior. |
Something you can do, to make navigation (feel) more smoothly, is to do expensive operations, such as setting ItemsSource of the datagrid, in the Loaded event. Anything you do in the constructor of a page, will be executed before the navigation takes place, however anything done in Loaded happens after the navigation to the page has taken place, making switching pages feel more smoothly. |
@chingucoding we use a similar approach to improve the feel when navigating to a new created page, but this issue happens when you navigate to a cached page with a large visual tree, in this case navigation freezes despite of all controls of the page are loaded. |
@asierpn , NavigationView seems to somehow disable this.NavigationCacheMode = NavigationCacheMode.Enabled. We haven't had time to look into this in detail so I haven't filed an issue. We've been using Pivot in place of NavigationView because of this problem. Your problem may be something completely different. We're finding caching of UWP pages to be extremely effective for our purposes using the above caching flag. It's a very large app with huge data needs. Page transitions are instantaneous. |
@asierpn , took a look at your code, looks like NavigationCacheMode.Enabled will become your very good friend. |
@Noemata We use a Frame control in the MainPage of the app to navigate to all Pages, NavigationCacheMode is enabled, but our app freezes after several navigation operations, this is very noticeable in low powered machines. It seems that it is related with the memory leaks, if you try the sample project I attached in this issue and navigates from Page1 to Page2 and back repeatedly you will notice that memory doesn't stop growing and after some time the UI starts freezing. |
@asierpn, I've tweaked your sample. I think I know what's happening. Look at how I set the cache size in MainPage. I get the expected behavior with this sample when the cache size is set correctly. Caching works quite nicely when everything is configured to accommodate the needs of the app. You could also pre-cache certain pages by doing a behind the scenes navigation to those pages if you want to hide the impact of a data load. Please let me know if something isn't clear. When cachesize is configured correctly, you will not see repeated "Page x not cached." messages in the debug output window. These should only appear once, when the page first loads. |
@Noemata Thank you for your time trying to help us, we know how caching works, if you don't set it the Frame has a default CacheSize of 10, but this issue happens also disabling the cache, enabling the cache helps to reduce the issue, but after a long use time navigating to different pages the issue always happens. As I've commented it's easy to reproduce the issue with the official XAML Controls Gallery app. |
@asierpn , if you're not on a recent OS build, UWP leaks in a number of ways. On the OS build I'm running on, I'm not seeing the problem you see (19042.906). I throttled the sample I sent through a 2K navigations on a release build. No slow down or excessive memory growth. I did switch to the latest nuget packages for my test. Also replaced the tabview with pivot. So it's possible the older libs/controls have issues. |
@Noemata, it's strange, I'm also using a recent OS build (19042.867) and we see this issue in all computers inside and outside our organization, tomorrow I will record an screencast to show you it better. |
@asierpn , suggest you switch to newer libs. It's looking like that is where your problem is. Sorry, I should have qualified that I switched. I too had problems with older Toolkit builds. When I swapped out the toolkit, I lost the Tabview control, since that's now in WinUI. I assumed the entire problem you were having was with navigation. Looks like it's elsewhere. My bad. |
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
In our case we are using UWP for a LOB app and we have found big performance issues in two common scenarios:
Steps to reproduce the bug
App1.zip
These issues are less noticeable if you use a powerfull machine, but with less power it becomes unusable (try it with a core i3 or i5 processor of a few years).
Expected behavior
A quick render of pages with 5000 items or more, and a smooth transition between tabs and pages, because this scenario is very common in LOB apps.
Version Info
No matter which package you are using, we are suffering this issue from the early versions of UWP.
NuGet package version: 2.3.200213001
The text was updated successfully, but these errors were encountered: