@MartinaKraus11
GDE in Angular and Web Technologies
Trainer and Consultant
Women Techmakers Ambassador
@MartinaKraus11
@MartinaKraus11
Time to interact
Initial loading time
Developing / Build time
Angular
declarative Code
ngc
JavaScript Code
export class AppCmp { title: string; ngComponentDef = ng.defineComponent( {...}) }
ngc
@Component({ selector: ‘app-component’ template: `<h1>{{ title }}</h1>` }) export class AppCmp {}
Scoping (ngModules)
Evaluation of
Property chains
Variables / function calls
Type checking
> ng new awesome-app
> ngc
// 11.0.2
> ng new awesome-app
> ngc
ViewEngine:
1,4MB
Ivy:
14kB
app.cmp.ts
app.cmp.html
app.cmp.scss
app.cmp.js
app.cmp.ngFactory.js
app.cmp.metadata.json
app.cmp.ngsummary.json
app.cmp.ts
app.cmp.html
app.cmp.scss
app.cmp.js
export function elementStart()
export function text()
Ivy instructions
Unsused Code
export function pipe()
Angular-Apps
Others
Delta.com: 4.2MB
Forbes.com: 5.7MB
Android Messages: 1.1MB
Grubhub: 3.4MB
microsoft.com is 1.4MB
amazon.com is 7.5MB
theverge.com is 9.6MB
Wikipedia pages are 223KB
reddit.com is 4.9MB
netflix.com is 4.2MB
twitter.com is 3.5MB
Stephen Fluin - https://fluin.io/blog/is-my-angular-performance-normal
static ngComponentDef =
core.ɵɵdefineComponent({…})
app.component.js
Component has all information for being compiled
Ivy provides stable API to ship code through NPM
No global compilation anymore
Modules already AOT
Cleaner API
Improvement of Stack Trace
Template creation in one file with controller code
Kara Erickson - https://bit.ly/3bgD3C9
tsconfig.json:
//to Opt-out:
"angularCompilerOptions": {
"enableIvy": false
}
Angular provides two compilers:
Ngtsc (Ivy compiler): compiles Ivy-compatible code
Ngcc (Compatibility Compiler): Convert old style modules
Better build times, thanks to incremental compilation
Smaller and faster bundles
Sets the ground for lazy-loading components
Is easy to debug
Introduces new non-zone.js based change detection
Uses higher-order components
Ivy reduces the bundle size significantly
Only re-compiles what changes
Backwards compatible with ngcc
me@martina-kraus.io
@MartinaKraus11
martina-kraus.io
Ping me:
Slides: slides.com/martinakraus/ivy-performance