Use array.[] instead of array.@each
In Ember, I knew array.@each
, array.length
, and array.[]
would all work in my computed properties, but it turns out array.[]
and array.length
are much more performant, and should be used over array.@each
in almost every case.
Use array.@each
when you need to know about a property/properties on a member of the array changing, for example:
array.@each.{foo,bar,baz}
will watch for changes to the foo, bar, and baz properties.
https://blog.eladshahar.com/performant-array-computed-properties.html
Tweet