Performace issues with Ionic2

Hi Focks,

We are facing performance issues with Ionic 2 framework.

‘Ionic Serve’ taking too much time to start the application and the rebuilding is also taking more time for small changes.

I have a Windows 10 machine with 8GB RAM and 1 TB HDD.

Below are the Versions I am using:

Cordova CLI: 6.5.0
Ionic Framework Version: 3.1.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.6
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.2
Xcode version: Not installed

And when Started the App, The console looks like this:

ionic-hello-world@ ionic:serve D:\Projects\select-account-mobile
ionic-app-scripts serve “–v2” “undefined” “–address” “0.0.0.0” “–port” “8100” “–livereload-port” “35729”

[09:45:49] ionic-app-scripts 1.3.0
[09:45:49] watch started …
[09:45:49] build dev started …
[09:45:49] clean started …
[09:45:49] clean finished in 3 ms
[09:45:49] copy started …
[09:45:49] transpile started …
[09:45:51] transpile finished in 1.92 s
[09:45:51] preprocess started …
[09:45:51] deeplinks started …
[09:45:51] deeplinks finished in 35 ms
[09:45:51] preprocess finished in 35 ms
[09:45:51] webpack started …
[09:45:51] copy finished in 2.15 s
[09:45:58] webpack finished in 6.79 s
[09:45:58] sass started …
[09:45:58] sass finished in 558 ms
[09:45:58] postprocess started …
[09:45:58] postprocess finished in 45 ms
[09:45:58] lint started …
[09:45:58] build dev finished in 9.37 s
[09:45:58] watch ready in 9.46 s
[09:45:58] dev server running: http://localhost:8100/

[09:46:02] lint finished in 3.65 s

Does any one have any Idea here? Any Tweeks to Improve this?

It’s weird that ionic info says app-scripts 1.3.6, but the build says 1.3.0. In any event, try upgrading to 1.3.7.

Also, 9 seconds from start to finish isn’t too bad for a build process.

1 Like

I agree, it’s a very decent time even for Ionic2, as you’re still in --dev mode (uncompiled, unminified app in browser). And you could have a Xeon working on compiler CLI it won’t be so much faster, it’s normal.

You can compare with uploading your build to Ionic View too, this will give you another point of reference.

And another option (I work on Ionic 2 for a while now), personnally I prefer testing on USB directly with ionic run --platform, this gives you plenty of choices (3) with Ionic cool platform :slight_smile:

I conclude saying if you use for example, ionic run android -l -c on CLI, you’ll get both pros of both, I mean by that both a direct view by USB in your connected device at any change, plus a return in the CLI of console logs and warnings.

(and I forgot in emulator SDK, that makes 4 ways of testing your app, but calling --emulate is a bit creepy on Android for me).

Sorry, I think I have posted wrong console…

Now check this:

[19:16:07] ionic-app-scripts 1.3.0
[19:16:08] watch started …
[19:16:08] build dev started …
[19:16:08] clean started …
[19:16:09] clean finished in 421 ms
[19:16:09] copy started …
[19:16:09] transpile started …
[19:16:52] transpile finished in 43.11 s
[19:16:52] preprocess started …
[19:16:52] deeplinks started …
[19:16:52] deeplinks finished in 168 ms
[19:16:52] preprocess finished in 171 ms
[19:16:52] webpack started …
[19:17:00] copy finished in 50.93 s
[19:17:42] webpack finished in 49.67 s
[19:17:42] sass started …
[19:17:51] sass finished in 8.89 s
[19:17:51] postprocess started …
[19:17:51] postprocess finished in 328 ms
[19:17:51] lint started …
[19:17:51] build dev finished in 103.08 s
[19:17:53] watch ready in 104.96 s
[19:17:53] dev server running: http://localhost:8100/

How many pages is your app? What kind of content/plugins do you have?

I have a very large app (250 pages) with lazy loading and it takes 3-5 minutes seconds for the web pack to finish.

Before lazy loading it was only a few seconds, so I think that lazy loading causes significant slowdown on ionic serve.

I have 4 pages and I have Leaflet plugin for that.