Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can Increase performance on my Ionic3 Anguar4 app?

Now I am working with Ionic3, Angular4 android app. It is taking a while to load initially. I mean I got a black blank screen for few seconds.How can I speed up this and avoid the black screen?

like image 941
Rajaa Avatar asked Jan 30 '23 04:01

Rajaa


1 Answers

I try to keep up-to-date a post about that subject on the Ionic forum, have a look to https://forum.ionicframework.com/t/app-boot-time-current-state-and-best-practices/

But right now, some keywords about your question would be, I guess

  • Use lazy loading: Lazy loading concept allows you to not load and not load all requirements of your pages and components at boot time. For example, really really summarized, if you've got a first page1 and a page2 which use componentA. Without lazy loading, everything gonna be loaded at boot time. With lazy loading, componentA not gonna be loaded at boot time because it's not needed for the loading sequence and will only be use later and therefore, you save a bit of time

  • check your code and the libs you use to spare size: Size of the app is the key. Bigger is your app, slower is your boot

  • check your statics assets: could you delete or compact images? could you delete fonts? or could you not embed fonts? again size is the key

  • do you use rxjs operators? recently it was announced a new way of importing them and therefore to let you only imports the one you need and not all operators, again, it allows to spare size

  • you could apply this thinking to other libs you use, like lodash or moment.js vs date-fns I guess. Do you import all the libs or only what you need? Think small is beautiful

I hope this helps ...

like image 167
David Dal Busco Avatar answered Feb 04 '23 00:02

David Dal Busco