App Start slower in Prod than in Dev Mode, why?

Hello,

when i am developing with “ionic serve” the Page gets loaded very fast in the browser.
Running on a device the app takes 15 seconds to start.
Why is the prod mode so slower ?
Also, i have an electron wrapper for my app (so no cordova plugins)
This is also loading slower, why ?

And why is the initial load so slow even if there are no Cordova-Plugins ?

I don’t have an answer as to why it’s that slow, hopefully you’re excluding the build time. I don’t think you should compare the browser load time on your PC to the one on the phone, it’s not quite the same. You should be comparing ionic run android/ios --prod to just ionic run android/ios.

1 Like

As @mich356c mentioned, ionic serve and any ionic run are two very different things. ionic serve is just a basic webserver serving you index.html and the JS code in it, ionic run (and its relatives) are a native mobile app running on your emulator or device and then serving the index.html.

Still, 15 seconds sounds very slow. Are you using the real prod mode ionic run android/ios --prod @mich356c mentioned?

Hi guys,
Thanks for the replies.
Thing is i don’t compare the Ionic serve to run on ios or android but run in the browser with ionic build browser.
So the build target is browser.
I don’t know if you know electron.
It’s like running in the chrome browser.
Triggering reload ist faster with ionic serve than with the finished build.

Production mode builds much slower because it is doing so much more work: upfront transpile, ahead-of-time compilation and minification.

I don’t mean the build process.
I mean the startuptime on location reload…

To repeat:

… or an Electron app server your index.html. This will always be slower - although it shouldn’t really be much slower than directly viewing it in the browser. Did you compare the generated JS/HTML code of the two options?

Hey there!
So what seems to be the issue here?

When you’re testing on a device, what kind of device is it?
iOS or Android?
Whats the OS Version?

There’s a number of things that could be going on that could be causing the app to have a slow startup time, so more specfics can help identify the issue.

Could you generate a timeline snapshot? What/Where is the browser spending most of time on startup?
We know that there is a large amount of time being spent parsing the code at startup, and this is something we’re focusing on right now and working on improving.

1 Like