11

I'm working on an Ionic 3 application (for Android only). Everything works great, except that the startup time of my App is a bit long (nothing excessive, but like 4~5 seconds) and some users are complaining about it. I'm pretty sure it is possible to do better as I have other Ionic apps that rarely take more than 2 seconds to launch. (I'm hiding the splash screen myself, once platform.ready() is called)

Now, I'm already using some of the techniques I often read about : I'm calling enableProdMode() and compiling with the --prod flag. I also added ProGuard (wasn't meant to speed things up but can still reduce number of Java classes so why not), and I tried using Crosswalk but it resulted in worse performances.

So I'm looking for the next step : I'm trying to diagnose what happens during the splash screen, and what can I do better. But I can't find a way to get numbers or stats about what takes long and where is the problem. Instinctively, I'd say that reducing the number of Angular classes by refactoring some views and reducing the number of native plugins in my code could help, but I have found no evidence of it.

So my two questions are :

  • Is there a way to see what takes time during the splash screen, before platform.ready is called ?
  • Are there general tips such as reducing the number of plugins or classes to improve startup time ?
8
  • Did you use Lazy Loading ?
    – fandro
    Oct 31, 2017 at 8:25
  • @fandro What do you mean by this ? Oct 31, 2017 at 8:26
  • 1
    Lazy Loading is a feature that allow you to load components just if they are called. I think you have load all the pages and plugins in the app.modules right ?
    – fandro
    Oct 31, 2017 at 8:27
  • Yes, the @NgModule in my app.module.ts has all my pages declared in declarations and entryComponents. Oct 31, 2017 at 8:29
  • Here is the problem
    – fandro
    Oct 31, 2017 at 8:29

1 Answer 1

9

You need to use the Lazy Loading. So you will have not all the pages and plugins loaded at startup. The Lazy Loading allow you to load just the page and plugins if it's called.

Here is some links to help you to solve the problem :

http://blog.ionic.io/ionic-and-lazy-loading-pt-1/

http://blog.ionic.io/ionic-and-lazy-loading-pt-2/

Hope it helps.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.