Performance: FormBuilder service
MEDIUM IMPACT
This affects the speed of form initialization and updates, impacting how quickly the form appears and responds to user input.
this.form = this.fb.group({ name: [''], email: [''], age: [''] });
this.form = new FormGroup({ name: new FormControl(''), email: new FormControl(''), age: new FormControl('') });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Manual FormControl creation | More JS objects created individually | Multiple reflows if controls trigger updates | Higher due to longer setup | [X] Bad |
| FormBuilder group method | Fewer JS objects, batched creation | Single reflow on form init | Lower due to optimized setup | [OK] Good |