IE 8 performance of custom fnRender
IE 8 performance of custom fnRender
Due to performance constraints (also with FF) I use a paged table with 4 records per page. Yes, IE already causes trouble with 4 records. FF is instantaneous when paging and IE always has this short (1 sec) delay per page change. The cause is this function:
[code]
"fnRender": function ( oObj ) {
if (oObj.aData['chemicalStructure'] != ''){
var html = cd_getSpecificObjectTag("chemical/x-cdx", "190", "120",
"CDCtrl" + oObj.iDataRow,"","True","False","True",
'data:chemical/cdx;base64,' + oObj.aData['chemicalStructure']);
return html;
} else {
return '';
}
}
[/code]
note that when commenting out the function or returning '' (empty string) instead of html the performance is good. So my question is what happens with the retuend html, where in datatables code would I need to look for possible enhancements?
(table is created from ajax source + server-side processing meaning there are only 4 records present...)
[code]
"fnRender": function ( oObj ) {
if (oObj.aData['chemicalStructure'] != ''){
var html = cd_getSpecificObjectTag("chemical/x-cdx", "190", "120",
"CDCtrl" + oObj.iDataRow,"","True","False","True",
'data:chemical/cdx;base64,' + oObj.aData['chemicalStructure']);
return html;
} else {
return '';
}
}
[/code]
note that when commenting out the function or returning '' (empty string) instead of html the performance is good. So my question is what happens with the retuend html, where in datatables code would I need to look for possible enhancements?
(table is created from ajax source + server-side processing meaning there are only 4 records present...)
This discussion has been closed.
Replies
[code]
$(document).ready(function() {
var table = document.getElementById('result')
for (i=0; i<4; i++){
var control = cd_getSpecificObjectTag("chemical/x-cdx", 300, 180,
"CDCtrl" + i,"","True","False","True");
//$('#structure').html(control);
var newRow = document.createElement("tr");
var newCol = document.createElement("td");
newRow.appendChild(newCol);
table.appendChild(newRow);
newCol.innerHTML = control;
}
});
[/code]
IE 8 Profiler: takes around 156 ms, multiple runs (unscientific)
Now change the execution order. First set innerHTML, then append:
[code]
$(document).ready(function() {
var table = document.getElementById('result')
for (i=0; i<4; i++){
var control = cd_getSpecificObjectTag("chemical/x-cdx", 300, 180,
"CDCtrl" + i,"","True","False","True");
//$('#structure').html(control);
var newRow = document.createElement("tr");
var newCol = document.createElement("td");
newCol.innerHTML = control;
newRow.appendChild(newCol);
table.appendChild(newRow);
}
});
[/code]
IE 8 Profiler: takes around 500 ms, multiple runs (unscientific). Over 3 times slower and clearly noticeable in the actual page load!
I'm pretty sure if this could be changed in daratables, my issue would disappear.
EDIT: This behavior only seems to occur with the control/object I need to use. With normal HTML or
like media player object, order does not seem to matter. Or the other possibiliy is the size of the strign passed to innerHTML which in my case i very large.