@MartinaKraus11
@MartinaKraus11
@MartinaKraus11
Time to interact
Initial loading time
Developing / Build time
GDE in Angular and Web Technologies
Trainer and Consultant
Women Techmakers Ambassador
Angular
declarative Code
ngc
JavaScript Code
ngc
JavaScript Code
@Component({ selector: ‘app-component’ template: `<h1>{{ title }}</h1>` }) export class AppCmp {}
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
// 9.0.2
> ng new awesome-app
> ngc
ViewEngine:
1,3MB
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
Template
function calls
elementStart()
text()
Angular
export function elementStart()
export function text()
any - unique instance for each module
platform - shared over more applications
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
'ng serve' also with AOT
decreased from 0.8x to 0.5x
(excluding typescript build )
Cleaner API
Improvement of Stack Trace
Template creation in one file with controller code
Opt-in:
>ng new ivy-app --enable-ivy
>ng build --prod
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
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