Performance: Starting to remove biggest bottlenecks from digest cycle, filters.

Biggest are releasedAt and showAll, both consuming more than 1000ms (!).
This commit is contained in:
Gunther Brunner
2014-06-11 16:02:04 +09:00
parent 4b19d960d2
commit f56d70cebb
3 changed files with 10 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
var oboe = require('oboe')
var _ = require('lodash')
module.exports = function DeviceServiceFactory($http, socket) {
module.exports = function DeviceServiceFactory($http, socket, $filter) {
var deviceService = {}
function Tracker($scope, options) {
@@ -94,7 +94,11 @@ module.exports = function DeviceServiceFactory($http, socket) {
}
}
// NOTE: For overall performance reasons, put all the filters here:
data.stateSorting = getStateSorting(data.state)
// TODO: i18n shortDate
data.releasedAtFormatted = $filter('date')(data.releasedAt, 'yyyy/MM/dd - X')
}
// For convenience, add the sorting priority to each state