Recently I've walked through several StackOverflow questions related to AngularJS optimization techniques:
AngularJS really slow at rendering with about 2000 elements?
How does data binding work in AngularJS?
Most of the answers were proposing an optimization technique called One-time binding, but my use case dictates that I can't use this approach, all of my data is interactive, the changes are pushed from server to client, plus there's quite a lot of data is required to be displayed. When server notification happens UI updates are required. So if I were to use the one-time binding it would break my page.
I've tried to analyse the reasons that make AngularJS slow in my case and I've found out that it's not the dirty checking itself that is slowing down the process. Modern javascript engines are able to dirty check tens of thousands object properties in just milliseconds. The root reason that make AngularJS slow is $watch
expression itself, each $watch
call is backed up with setTimeout
calls plus some AngularJS internal overhead. The main problem is that these calls pass control to browser's internal message loop, which from program's perspective does nothing except imposing latency into each step of data displaying process.
So my question is the following: in contrast to one-time binding, I would like to have a way to group my one way binding expressions {{ someObj.someProperty }}
into one $watch
call, something like
{{ myBulkWatch::someObj.someProperty1 }}
{{ myBulkWatch::someObj.someProperty2 }}
...
{{ myBulkWatch::someObj.somePropertyN }}
I understand that there's no such functionality yet, but maybe it's possible to at least emulate the feature with existing Angular's instruments?
Any thoughts on this subject?
Thank you in advance!