Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localize pipe slow performance #142

Open
vlados opened this issue Sep 17, 2018 · 1 comment
Open

Localize pipe slow performance #142

vlados opened this issue Sep 17, 2018 · 1 comment

Comments

@vlados
Copy link

vlados commented Sep 17, 2018

When I am using localize in a long list is getting very bad performance:

<a [roterLink]="['user',user.id] | localize" ngFor="let user of users; trackBy: trackFn">{{ user.name }}</a>

When I replace it with this is much better

<a [roterLink]="['/' + currentLang + '/user',user.id]" ngFor="let user of users; trackBy: trackFn">{{ user.name }}</a>

How I can use LocalizePipe without affecting the performance?

@luxalpa
Copy link

luxalpa commented Sep 25, 2018

LocalizePipe is an impure pipe, meaning whenever your component updates, the pipe will update (likely multiple times). Its performance will be much worse in development mode than in production. A solution could be to make sure the change detector doesn't run over your component too frequently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants