IterableDiffer.diff compares the current collection with its tracked state. It returns IterableChanges when differences exist, or null when none exist, allowing ngDoCheck to skip unnecessary view work. section 15.3.4
Detecting added collection items
let changes = this.differ?.diff(this.dataSource); if (changes != null) { changes.forEachAddedItem(addition => { if (addition.currentIndex != null) { this.container.createEmbeddedView( this.template, new PaIteratorContext( addition.item, addition.currentIndex, this.dataSource.length)); } }); } This pattern creates embedded views only after diff reports a change, rather than rebuilding the entire collection during every check. section 15.3.4
