Code Monkey home page Code Monkey logo

learn-angular-optimizations's Introduction

learn-angular-optimizations

We can divide angular optimizations into 2 groups:

  • Network optimizations: improve mostly the load time (latency / bandwidth)
  • Runtime optimizations: improve runtime performance (change detection / rendering)

Network optimizations

  1. Lazy loading (router)

  2. Minification / Dead Code Elimination

  3. Compression (gzip / brotli)

Resources:

  • "Building an Angular Application for Production": blog.mgechev.com/2016/06/26/tree-shaking-angular2-production-build-rollup-javascript/
  • "2.5X Smaller Angular Applications with Google Closure Compiler": blog.mgechev.com/2016/07/21/even-smaller-angular2-applications-closure-tree-shaking/
  • hacks.mozilla.org/2015/11/better-than-gzip-compression-with-brotli/
  1. AOT compilation

  2. Pre-fetching Resources (preload, prefetch, preconnect, dns-prefetch, prerender)

  • preload: download and cash asap (for resources now)
  • prefetch: download and cash on idle (for next page resources)
  • dns-prefetch: resolve dns before
  • preconnect: connect to domain before
  • prerender: asks browser load url address and prerender it on "invisible tab" (you know that user will go to this page)
  1. Caching

  2. Service Workers

Resources:

  • Angular Service Worker (angular.io/guide/service-worker-intro) โ€” Aims to automate the process of managing Service Workers. It also contains Service Worker for caching static assets and one for generating application shell: developers.google.com/web/updates/2015/11/app-shell?hl=en.

Runtime optimizations

  1. OnPush CD + Immutable

  2. Smart + Dumb components

  3. Pure pipes instead of method calls in templates

  4. Pure pipes with caching (@memo)

  5. *ngFor with trackBy

  6. Async pipes

  7. Detaching CD

  8. Informative configurations: linting, bundle size budgets

  9. Use enableProdMode

  10. WebWorkers

  11. SSR

  12. Unsubscribe logic (takeUntil)

  13. providedIn

Resources

learn-angular-optimizations's People

Contributors

outstandyy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.