英文:
How many ways are there to increase the performance in angular?
问题
我是一个Angular前端开发者,我对运行时性能测试还很新手。
为了检查性能,我下载了Google插件,"Performance-Analyser"。我得到的性能时间如下。
对于DOM处理本身,它需要5.4秒。
(对于我们的项目,我们正在使用Angular 6.)
有人可以告诉我一些提高性能的技巧吗?还请给我一些链接吗?
有人可以帮帮我吗?
英文:
I am an angular front end developer and I am new for testing the run time performance.
For checking the performance I downloaded the google plugin, "Performance-Analyser". And I got the performance time as below.
For DOM processing itself, its taking 5.4 Secs.
(For our project, we are using angular 6.)
Can anybody tell some tips for increasing the performance. Also please some links for me??
Can anybody help me?
答案1
得分: 2
以下是翻译好的部分:
- 构建优化 https://github.com/angular/angular-cli/tree/master/packages/angular_devkit/build_optimizer
- 使用延迟加载模块
- 为了运行时性能,请使用OnPush变更检测,仅在输入发生变化时运行变更检测,不要忘记取消订阅观察者
- 保留空白以移除所有空格
"angularCompilerOptions": {
"preserveWhitespaces": false
}
- 您可以升级到更新版本的Angular并使用Ivy Render Engine 更多详细信息
- 启用Gzip压缩 https://varvy.com/pagespeed/enable-compression.html
- 服务器端渲染:在服务器上渲染应用程序的第一页可以提高性能、速度和加载时间
- 您可以使用webpack Bundle Analyzer进行性能分析,以移除未使用的项目 链接在此
英文:
there is some actions that can optimize your application like:
-
Build optimization https://github.com/angular/angular-cli/tree/master/packages/angular_devkit/build_optimizer
-
Using Lazy loaded modules
-
for Run Time Performance use OnPush Change Detection to run change detection only when an Input changes and don't forget to unsubscribe from your observables
-
Preserve Whitespaces to remove all white spaces
"angularCompilerOptions": {
"preserveWhitespaces": false
} -
you can upgrade to newer version of angular and use Ivy Render Engine more details
-
enable Gzip compression https://varvy.com/pagespeed/enable-compression.html
-
Server-side rendering: Rendering the first page of your application on the server can boost performance, speed and load time
-
you can use webpack Bundle Analyzer for performance analysis to remove unused items in your bundle link here
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论