$http should coalesce calls to $apply
Presently, $http calls $apply for every request response, even if they come in within milliseconds of each other. Using a short timeout (0ms, which in practice works out to 0-10ms) to $apply can reduce a lot of waste.
See example implementation here: https://github.com/kseamon/angular.js/compare/http-coalesce?expand=1
Using this code (Not ready for a pull request as it breaks tests and mocks, etc), I see the number of $apply calls in my app's startup drop from 40 to 16.
+1
+1
+1
+1
I'm willing to tackle this, if we are okay going ahead with it @IgorMinar ?
I've got a PR in progress that I have not had a chance to work on in a while.
If you want to start from scratch, make sure to cover these points:
Implement $applyAsync on $rootScope.
Make $http and $cookies use it.
Make sure that regular $apply calls flush the queue and cancel the timeout.
+1
+1
@kseamon You could also push the branch to Github, if it's usable for further work.
ping @kseamon