Fix slowdowns when navigating
See original GitHub issueContinued from https://github.com/fsprojects/Fabulous/issues/373#issuecomment-480486017
I just tried the AllControls
sample on my Android device (release mode) and WPF on my beefy desktop computer. There are fairly noticeable slowdowns when navigating on Android, and less so (sub-second, but still noticeable) on WPF. After a cold start on Android, navigating to TabbedPage 3 takes around 2 seconds. I have a hard time imagining clients/employers (or users) accepting that, regardless of maintenance/agility benefits of an Elmish architecture.
- What is the root cause of the navigation slowdown, particularly on Android?
- Which factors influence it? (Devices? Model size? etc.)
- Can anything be done about it? What?
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (3 by maintainers)
Top Results From Across the Web
How to Fix Input Lag and Slow Performance in Google ...
Close running programs and tabs that aren't in use. Clear Chrome's cache and cookies. Disable browser extensions and refresh the page. Turn off ......
Read more >Google Maps: Missing your turns? Here's how to fix ...
Q: I'm using Google Maps for driving directions in an unfamiliar city and it's lagging which is causing me to miss my turns....
Read more >Helpful Fix for Laggy gesture navigation : r/android_beta
I found that if you force stop Pixel Launcher and clear the cache for it, the gestures go back to normal.
Read more >Android Auto laggy and slow when using Spotify + ...
When first connecting my phone to my car and starting up Android Auto, everything seems smooth and fluid. However, after a few minutes...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, reflection can slow down performance. But you will only notice performance issue if you make intensive use of it. Individually, it’s not that bad.
That’s why we tried to limit reflection to a minimum in Fabulous.XamarinForms.
The line you’re referencing is one of the few (if not the only one) to use reflection. So I don’t think it’s the source of the slowdowns…
Instead, I think we’re a bit too heavy on the memory. Every time I noticed slowdowns, a corresponding output in the console indicated the GC triggered. GC pauses the app for several milliseconds, enough to make it noticeable sometimes.
So we either don’t clean up enough memory, or we’re instantiating too many small objects that clutter up the memory forcing the garbage collector to pass.
This seems to fit because iOS is not plagued by those slowdowns, while Android takes it fully. On iOS, it’s fully native no GC (only reference counting) - on Android, there’s 2 of them (.NET GC and JVM GC)
Does that explain the poor performance when navigating, but much better performance at the page after navigation?
I like the idea. The question is how to set the thresholds so the warnings are real and not spammy.
Also, I think clear documentation can get you far on its own. 😃
Some kind of
Key
property might be good for collections. It would allow you to do smarter differential update of collections, regardless of element ordering. AFAIK it’s an important optimization in React (they throw warnings at you if you don’t supply it in collections), see the React docs on reconciliation. Not sure how easy it is though, given that you can add any attribute to any HTML DOM element, but here we are working with objects with a limited set of properties.