I profiled one of my apps with Batarang. i noticed that for a page with six smaller ui grid instances the GridRenderContainer.prototype.getMargin takes about 60% of the cpu time.
The method is called from a template:
$templateCache.put('ui-grid/uiGridRenderContainer',
...{ 'margin-left': colContainer.getMargin('left') + 'px', 'margin-right': colContainer.getMargin('right') + 'px' }...
The function loops over viewportAdjusters. Maybe it is worthwhile to optimize the method. For example, it filters out the adjustment results of many of the calls made:
if (adjustment.side && adjustment.side === side)
Such calls could be avoided. Or maybe there is a way to cache the margins and avoid the loop altogether.
I profiled one of my apps with Batarang. i noticed that for a page with six smaller ui grid instances the GridRenderContainer.prototype.getMargin takes about 60% of the cpu time.
The method is called from a template:
$templateCache.put('ui-grid/uiGridRenderContainer',
...{ 'margin-left': colContainer.getMargin('left') + 'px', 'margin-right': colContainer.getMargin('right') + 'px' }...
The function loops over viewportAdjusters. Maybe it is worthwhile to optimize the method. For example, it filters out the adjustment results of many of the calls made:
if (adjustment.side && adjustment.side === side)
Such calls could be avoided. Or maybe there is a way to cache the margins and avoid the loop altogether.