问题描述
我正在用Ionic构建一个简单的应用程序。但我的应用程序在冷启动时的初始加载时间存在性能问题。
I am building a simple app with Ionic. But my app has a performance issue with initial loading time on cold start.
以下是我的工作:
- 集合 - 重复而不是ng-repeat与'track by'
- 原生卷轴:
溢出-scroll ='true'
- 不使用缓存
$ ionicConfigProvider.views.maxCache(0);
- collection-repeat instead of ng-repeat with 'track by'
- native scroll:
overflow-scroll='true'
- use no cache with
$ionicConfigProvider.views.maxCache(0);
我不能使用 crosswalk-webview
因为其中一个库I我正在使用。
I cannot use crosswalk-webview
because of one of the library I am using.
我觉得我所做的就是改善与初始加载无关的离子性能。
I feel like all I have done is to improve ionic performance that is not really related with initial loading.
任何建议或意见都将不胜感激。
Any advice or suggestion would be appreciated.
推荐答案
不看你的代码,离子和依赖版本,以及一些输出,很难说清楚。但是,更新到最新版本的Ionic Cloud并使用生产标志进行构建可将我的冷启动加载时间从20秒减少到4秒以内。
Without seeing your code, ionic and dependencies versions, and some output, it's hard to tell exactly. However, updating to the most recent version of Ionic Cloud and building with the production flag reduced my cold start load time from 20+ seconds to under 4 seconds.
npm install @ionic/cloud-angular@latest --save
ionic build --prod
构建需要更长的时间,但你的冷启动时间要快得多。
It will take longer to build but you'll have a much faster cold start time.
这篇关于离子初始加载时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!