I have a variable user_roles in my component file which gets initialized by an API on ngInit() and does not change after that.
this.service.getUserRoles().subscribe(
      data => {
        this.user_roles = data;
      }
    )
user_roles is an array which contains the permissions for that user : user_roles = ['admin', 'mediator', ...]
In my template I have code that displays components based on user_role:
<div *ngIf="user_roles.includes('admins') || user_roles.includes('mediator')">
    <div ....
    .
    . 
    .
Does .includes() run every time some other variable changes and the change detection loop runs? If it does, then what alternative can I use to improve performance?
 
                        
Yes it will.
angularchange detection doesn't mean if a property changes, update its dependencies. That's actually thevueway. In realityangularchange detection means everytime a async action(PromiseeventsetTimout) happens, re-evaluate every template binding. So yes,includeswill be called again.The simplest way to verify is following