Turn off computed properties/observers for large data sets


#1

When loading large data sets (outside of ember-data), it seems that every little property change triggers a computed property or observer. Is it possible to defer these changes to the very end of the data load?


#2

This really depends largely on how you have your app architected. Property changes are deferred until the end of the RunLoop and are coalesced. However, at the moment, observers trigger immediately and will trigger multiple times for property changes that would otherwise be coalesced in a single run loop. Also, if you have an observer on a CP, that CP won’t be lazily computed because the observer will get the value immediately. We’re planning to make observers coalesce and trigger at the end of the RunLoop which might improve your scenario.


#3

@pwagenet, making observers run at the of the RunLoop will be awesome, we will gain significant performance improvements in our apps. Btw, @moger777 you could use Em.run.once in some of your observes, it depends on how you have architected your app, but that could help.


#4

I’ve definitely done this in some cases. It can be a very effective workaround until we have proper support for asynchronous observers.


#5

One small point to note is not to pass an anonymous function but a function handle while calling Ember.run.once. It threw me off for a while.