13 Ways to Improve the Performance of Your App
This is not a complete list, just what came to mind right now.
The important (though unfortunate) thing to take from this is that great performance doesn't come easily and there are lots of things you can (or have to) do to give your users an awesome experience.
Note that some MVVM purist may dispute some of these but they're based on real world experience.
- Get off the UI thread - Don't use it when you don't have to. Keep the UI responsive.
- Don't use value converters - They have a much greater performance impact than direct properties.
- Don't use dependency properties when you don't need to - If regular properties will work for your needs then keep it simple as they're much faster to read
- Have fewer external dependenices - Loading fewer third party libraries saves time
- Split up your assemblies - Don't load all the pages (and code) in your app when you don't need to
- Cache images (and data) - Downloading external resources takes time. Don't repeat it unnecessarily. The same goes for processing or reformatting data.
- Use a "boot loader" - If you have a large app or a complicated start up process, only have the bare minimum in the app and push everything else to separate assemblies. This will help you get as animated loading page up as quickly as possible.
- Preload/prefetch data - If you can, get the data before you need it so that when you do need it the user doesn't have to wait.
- Lazy load data - If there is a large amount of data, only load it as you need it. Don't waste time forcing your user to wait while it's all loaded.
- Reuse [data] templates (load less xaml) - Loading fewer templates is faster. Make sure you don't reload the same ones repeatedly
- Have less XAML - Don't use any more XAML than you need to. I often see slow apps which have unnecessarily complicated, nested controls when the same thing coudl have been created with fewer controls.
- Avoid nested margins - Reduce the amount of work the loyout engine has to do measuring the elements in creates.
- Don't use XAML - Yes, it's extreme but you can get better performance from a UI created in code than in XAML (you save the parsing time) This can make supporting the code and making changes harder though.
The above has helped me in the past. Hopefully it may help you too.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)