ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

Speed up initial loading

Open TheMohanraj opened this issue 10 years ago • 159 comments

We're developing an app which is partially native and partially hybrid. We will open cordova activity when user clicks on an menu item and finish the activity when user clicks back. Problem with this approach is, it takes a while to render on the screen for first time. We are hosting all the resource files in the assets folder so caching doesn't make much sense. Is there any progressive way to load the application?

TheMohanraj avatar Jun 06 '16 07:06 TheMohanraj

Hello @dheran . Start up time is something that we are working hard at reducing as we speak (: . We are currently working on a new build chain that will make Ionic apps alot smaller and which will include offline template compiling. With these two improvements you can expect to see a huge improvement in startup time. I would ask around on StackOverflow or our forums (forum.ionicframework.com) for ways to "preload" a webview thats inside a native app. Thanks for using Ionic!

jgw96 avatar Jun 06 '16 13:06 jgw96

@jgw96 Hey, Is there any existing feature request or issue? So that it will be easy to follow up and able to use it once it got implemented.

TheMohanraj avatar Jun 09 '16 17:06 TheMohanraj

@dheran Good question! At the moment there are no good tracking issues for this, as this is in the very early stages, but it is a high priority for us and the ionic-cli team is making alot of good progress on it. Once this gets farther along i will try to update this issue with our progress so you know what to expect (:

jgw96 avatar Jun 09 '16 17:06 jgw96

@jgw96 then, why don't keep it open until?

TheMohanraj avatar Jun 09 '16 18:06 TheMohanraj

@jgw96 Removing unused css while build process will also contribute a lot

TheMohanraj avatar Jun 16 '16 13:06 TheMohanraj

I use ionic2 build a mobile website, then I find when I use android 4.4 browser open it, it is very slowly. Have any good suggestions to me ? website: https://zhaoxie.net/static/weixin/index.html image

Cordova CLI: 6.1.1 Ionic Framework Version: 2.0.0-beta.6 Ionic CLI Version: 2.0.0-beta.31 Ionic App Lib Version: 2.0.0-beta.17 ios-deploy version: 1.8.5 ios-sim version: 5.0.6 OS: Mac OS X El Capitan Node Version: v5.3.0 Xcode version: Xcode 7.2 Build version 7C68

asd2766 avatar Jun 20 '16 08:06 asd2766

@jgw96 any idea which version will get this feature?

TheMohanraj avatar Jun 22 '16 07:06 TheMohanraj

Hey @dheran ! Good question! We have a working implementation of treeshaking with webpack 2 as of a few days ago and are still working on using the offline compiler. After reading the Angular team's meeting notes today it looks like they are not gonna call the offline template compiler "stable" until Angular 2 rc 4, but i hope that we can have an implementation of the offline compiler before then.

jgw96 avatar Jun 22 '16 07:06 jgw96

@jgw96 Seems they've already closed the issue. https://github.com/angular/angular/issues/3605 and Angular RC 4 is almost 33% complete (in milestone). Can we expect the new compiler in ionic beta 10 or 11?

TheMohanraj avatar Jun 22 '16 11:06 TheMohanraj

Hi @dheran, we're actively working on it. This is an extremely high priority item for us so please rest easily knowing we'll have it done as soon as we can.

Thanks, Dan

danbucholtz avatar Jun 22 '16 15:06 danbucholtz

@danbucholtz can you please suggest me with any temporary workaround to reduce initial rendering time until official solution comes. because, I've been given two choices, either need to fix this issue or drop and build the same with native code.

TheMohanraj avatar Jun 23 '16 05:06 TheMohanraj

Hi @dheran,

Sorry, we aren't providing any work arounds at this time because we don't have any 😄 Please remember we are in the beta phase and are waiting on Angular to get offline template compiling and minification into a good state so we that we can mimic what they do. This is extremely important for us to get into the build process ASAP, but it's just not ready yet.

Thanks, Dan

danbucholtz avatar Jun 23 '16 14:06 danbucholtz

+1

We can wait till rc4, but please keep the offline template compiling high priority. FYI, the initial time for our app is around 8s, but the initial time of other native app is about ~1-4s. We really need to shorten the initial time.

Finally, thanks for the work.

grapemix avatar Jun 27 '16 19:06 grapemix

@grapemix Its definitely high priority! We are working with the Angular team on a constant basis to get offline template compiling working with Ionic along with tree shaking and aggressive minification so that we can get our average app size much smaller. As mentioned above there are some changes to Angular that we are waiting on right now, but it will definitely get done (:

jgw96 avatar Jun 27 '16 20:06 jgw96

+1

paulogr avatar Jun 30 '16 01:06 paulogr

+1

liujinxing avatar Jul 13 '16 03:07 liujinxing

@jgw96 @danbucholtz guys any progress in this? can we get fix in beta 11?

TheMohanraj avatar Jul 13 '16 09:07 TheMohanraj

+1

hackfrag avatar Jul 13 '16 09:07 hackfrag

In which repository are you guys tracking this I think I will be able to help a little regarding webpack

prijindal avatar Jul 13 '16 12:07 prijindal

@prijindal,

I believe @jthoms1 is doing the work on this branch. https://github.com/driftyco/ionic/tree/adding-offline-template-compiling

Thanks, Dan

danbucholtz avatar Jul 13 '16 14:07 danbucholtz