Thursday, November 21, 2019

use SimpleChanges with the OnPush ChangeDetectionStrategy in Angular 5 to further minimize expensive operations in listening

Doing some filtering as seen in the third blob of code here before calling out to a method that transforms data handed in via an Input should be a performance improvement beyond wrapping the inbound value with the method call at the Input at the template itself. In the later scenario the filtering is going to happen whenever any one Input updates (even with the OnPush ChangeDetectionStrategy) and in the earlier scenario we can only react when our Input in particular is changing up.

No comments:

Post a Comment