I have a performance question for Angular 1.x. Is there any performance benefits to use function expressions vs filters to get values based on keys? Let me explain with examples.
I currently have a complex angular application with a number of filters used to get values based of an objects key. I have a lot of key/ID references in my data so I use a filter to get field values based of the key.
E.g. {{ ID123 | getField:'object':'field'}}
The custom filter would then do a async call (to DB) to get the object name I specify based on the key (ID123) and return the field I specify (instead of just showing the key).
I'm currently in the process of doing some performance clean up and I've read a lot about avoiding filters since they are a hit on performance. One thing I'm doing is using one-time bindings {{::ID123 | getField:'object':'field'}}
but in some scenarios I can't do that (since I need the value to update).
I was then looking at function expressions instead of custom filters, e.g. {{getField(ID123,'object','field')}}.
But I'm not sure if it would get any performance benefts.
You can see my plunker example where I compare the two.
https://plnkr.co/edit/hlL2LSOGjq5HsImUyqyu?p=preview
Would there be any performance benefits? Also is there a way to test or benchmark the difference between the two?
Thanks