title: Are impure pipes in Angular 2 (pure = false) bad for my performance?
body: <p>I have a translate pipe, which accepts a string as key, and returns the translated string from a dictionary. The pipe looks like this:</p>
  
  <pre><code>import {Pipe, PipeTransform} from 'angular2/core';
  import {TranslateService} from './translate.service';
  
  @Pipe({
      name: 'translate',
      pure: false
  })
  export class TranslatePipe implements PipeTransform {
  
      constructor(private _translateService : TranslateService) {
      }
      transform(key: string): any {
          var translatedText = this._translateService.resources[key];
          if (translatedText)
              return translatedText;
          return key;
      }
  }
  </code></pre>
  
  <p>I use the pipe in my templates like this: </p>
  
  <pre><code>&lt;div&gt;{{'login_EnterNewPassword'|translate}}&lt;/div&gt;
  </code></pre>
  
  <p>Which will be rendered in my HTML like this:</p>
  
  <pre><code>&lt;div&gt;Please enter a new password&lt;/div&gt;
  </code></pre>
  
  <p>So far so good!</p>
  
  <p>The TranslatePipe depends on the TranslateService, which holds a dictionary called resources with translations of the current language. The TranslateService's resource gets loaded with an ajax http call to a server, and it can get reloaded behind the scenes, if a user selects a different language. </p>
  
  <p>Because i need my UI to update all texts when this happens, i have set the pure property of the pipe to false.</p>
  
  <p>Everything works perfect, but the thing is, the pipe gets executed very often, since it's impure. If the user enters a 10 character password, change tracking starts on every key-down and key-up, and the pipe gets executed hundres of times for all different translated texts on the page.</p>
  
  <p>The main question is: Is this a bad thing, and does it have much negative impact on the overall performance??? </p>
  
  <p>Or is there another way to force angular to reevaluate everything on demand, for example only when the language changes???</p>