有多少种方法可以提高

有多少种方法可以提高

本文介绍了有多少种方法可以提高 angular 的性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名 Angular 前端开发人员,我是测试运行时性能的新手.

为了检查性能,我下载了谷歌插件Performance-Analyser".我得到的表演时间如下.

对于 DOM 处理本身,它需要 5.4 秒.

(对于我们的项目,我们使用的是 angular 6.)

谁能告诉一些提高性能的技巧.还请给我一些链接??

有人可以帮我吗?

解决方案

有一些操作可以优化您的应用程序,例如:

  1. 构建优化

    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?

    解决方案

    there is some actions that can optimize your application like:

    1. Build optimization https://github.com/angular/angular-cli/tree/master/packages/angular_devkit/build_optimizer

    2. Using Lazy loaded modules

    3. 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
    4. Preserve Whitespaces to remove all white spaces

      "angularCompilerOptions": { "preserveWhitespaces": false }

    5. you can upgrade to newer version of angular and use Ivy Render Engine more details

    6. enable Gzip compression https://varvy.com/pagespeed/enable-compression.html
    7. Server-side rendering: Rendering the first page of your application on the server can boost performance, speed and load time

    8. you can use webpack Bundle Analyzer for performance analysis to remove unused items in your bundle link here

    这篇关于有多少种方法可以提高 angular 的性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 20:21