有多少种方法可以提高Angular的性能?

huangapple go评论82阅读模式
英文:

How many ways are there to increase the performance in angular?

问题

我是一个Angular前端开发者,我对运行时性能测试还很新手。

为了检查性能,我下载了Google插件,"Performance-Analyser"。我得到的性能时间如下。

有多少种方法可以提高Angular的性能?

对于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.

有多少种方法可以提高Angular的性能?

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

以下是翻译好的部分:

  1. 构建优化 https://github.com/angular/angular-cli/tree/master/packages/angular_devkit/build_optimizer
  2. 使用延迟加载模块
  3. 为了运行时性能,请使用OnPush变更检测,仅在输入发生变化时运行变更检测,不要忘记取消订阅观察者
  4. 保留空白以移除所有空格
"angularCompilerOptions": {
    "preserveWhitespaces": false
}
  1. 您可以升级到更新版本的Angular并使用Ivy Render Engine 更多详细信息
  2. 启用Gzip压缩 https://varvy.com/pagespeed/enable-compression.html
  3. 服务器端渲染:在服务器上渲染应用程序的第一页可以提高性能、速度和加载时间
  4. 您可以使用webpack Bundle Analyzer进行性能分析,以移除未使用的项目 链接在此

有多少种方法可以提高Angular的性能?

英文:

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的性能?

huangapple
  • 本文由 发表于 2020年1月6日 15:21:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/59608142.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定