fnScrollDraw slow in IE, possible fix inside
fnScrollDraw slow in IE, possible fix inside
Buey
Posts: 4Questions: 0Answers: 0
Using DataTables 1.9.4:
One of our tables was taking between 3-7 seconds to load in IE, and through the profiler we traced it down to css.get([width or height]) calls happening within fnScrollDraw (taking about 70% of the draw time). I found that $(nSizer).width() was being called in multiple places and simply preassigned it to a variable, which dropped the time for this issue from 3-6 seconds to 200ms.
Is there a reason why $(nSizer).width() needs to be calculated separately for each child? Our table still looks the same, but I want to make sure.
Thanks.
One of our tables was taking between 3-7 seconds to load in IE, and through the profiler we traced it down to css.get([width or height]) calls happening within fnScrollDraw (taking about 70% of the draw time). I found that $(nSizer).width() was being called in multiple places and simply preassigned it to a variable, which dropped the time for this issue from 3-6 seconds to 200ms.
Is there a reason why $(nSizer).width() needs to be calculated separately for each child? Our table still looks the same, but I want to make sure.
Thanks.
This discussion has been closed.
Replies
Allan
Using jshashtable: http://www.timdown.co.uk/jshashtable/
[code]
function _getCachedValue(sizer, func) {
var key = sizer;
if (func == 'width')
key = sizer.attributes['aria-label'].value;
var value = _sizerHash.get(key);
if (!value) {
var aValue;
switch(func) {
case 'width':
aValue = $(sizer).width();
break;
case 'outerWidth':
aValue = $(sizer).outerWidth();
break;
case 'height':
aValue = $(sizer).height();
break;
case 'height(0)':
aValue = $(sizer).height(0);
break;
}
value = aValue;
_sizerHash.put(key, value);
}
return value;
}
[/code]