Tips to speed up cordova startup


#1

Looking for tips to reduce the startup time of a Cordova application.

Mine is built for Windows 10 mobile, but I have a high startup time (10-15 seconds) before my deviceready actually fires. Where should I start looking for culprits? Here’s a list of plugins. I believe it’s a vanilla plugin list so I’m not sure what can stay or go.

Also, since Windows 10 UWP already supports JavaScript apps, why would I need to include a plugin for the keyboard?

  <plugin name="cordova-plugin-device" spec="~1.1.3" />
  <plugin name="cordova-plugin-console" spec="~1.0.4" />
  <plugin name="cordova-plugin-whitelist" spec="~1.3.0" />
  <plugin name="cordova-plugin-splashscreen" spec="~4.0.0" />
  <plugin name="cordova-plugin-statusbar" spec="~2.2.0" />
  <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
  <plugin name="cordova-plugin-media" version="2.4.0" />
  <plugin name="cordova-plugin-compat" version="1.0.0" />
  <plugin name="cordova-plugin-file" version="4.3.0" />
  <plugin name="cordova-plugin-media-capture" version="1.4.0" />
  <plugin name="cordova-plugin-camera" version="2.3.0" />

#2

Make sure you’re running a prod build with the --prod flag.

ionic run windows --prod

#3

To answer your question because it was written that way in the Cordova docs. Check the cordova.apache.org docs.


#4

I checked out http://cordova.apache.org/docs/en/6.x/guide/next/index.html#2-performance-considerations however these tips are more application specific. My problem is Cordova takes 10-15 seconds to warm-up before my application code runs.

I’ve reduced the number of plugins, but this made zero difference. From the time the app launches and the deviceready event fires, it’s still 10-15 seconds. I’ve read that an app can take 2 seconds to typically load. The only times I get that speed is when suspending/resuming the app, and that’s only if the phone hasn’t dumped the app from memory.


#5

What is the achievable baseline?
How long does starting an empty project take?


#6

From what I remember, a UWP JavaScript app starts much faster than Cordova (it’s been a while). I’ll have to do my own testing to confirm.

I may look at removing Cordova entirely and hosting everything in a UWP JavaScript app. This is the first time I’ve coded a Cordova app, so I’m assuming that I have a configuration problem. I could also deploy to other devices (IOS, Android) and see what performance is like there.

In my experience, frameworks/devs are not “completely” committed to Windows platform (Ionic being one of the rare exceptions). It wouldn’t surprise me though, if Cordova ran great on iOS/Android and ran OK on Windows.


#7

You should probably try both: Build a plain “Hello world” UWP JS app and see how long it takes to start. Then also do the same with an empty Cordova/Ionic project and compare. Maybe your device is just not optimal or something like that. When you have these numbers you are sure if it is worth investing more time on trying to fix some possible configuration problem in Cordova.