A speed issue I believe with DataTables

A speed issue I believe with DataTables

jamesjw007jamesjw007 Posts: 35Questions: 0Answers: 0
edited July 2012 in General
Here is the code I am using:

var oTable = jQuery('#dyntable').dataTable({
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"fnServerParams": function (aoData) {
var sReportType = (jQuery('#report_type').val() == "") ? "Downline" : jQuery('#report_type').val();

aoData.push({
"name": "report_type",
"value": sReportType
});
aoData.push({
"name": "rankid",
"value": (jQuery('#rank_id').val() || []).join(",")
});
},
"sAjaxSource": "ajax/message_center_compose.asp",
"aoColumnDefs": [
{ "sWidth": "20px", "aTargets": [0] },
{ "sWidth": "60px", "aTargets": [1, 4, 5, 6] },
{ "bSortable": false, "aTargets": [0] },
{ "bSearchable": false, "aTargets": [0, 4] },
{ "sClass": "text-align-center", "aTargets": [0, 1, 5, 6] },
{ "sClass": "text-align-right", "aTargets": [4] }
],
"fnDrawCallback": function (oSettings) {
convertCheckbox();
doNotSendList(oTable, aDoNotSend);
verifyChecked(oTable, aDoNotSend, nTr);
},
"fnServerData": fnDataTablesPipeline,
"bDeferRender": true
});

I allow them to select out filters. The initial report loads bringing back 55 results. It does this in about 1 seconds. When I select filters and add in ranks i want to filter this by it takes around 13-30 seconds.

The stored procedure itself runs in under a second when using the same criteria..

Any idea where I can start looking to see where the speed bump is?

Replies

  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin
    I'd suggest using the Chrome developer tools to see how long the Ajax response takes in the first instance.

    Allan
  • jamesjw007jamesjw007 Posts: 35Questions: 0Answers: 0
    Chrome states 4.78 seconds is spent in (program) with the first request.

    It states 22.41 seconds is spent in (program) with the second request with filters.

    Cannot for the life of me figure out why the second option is so much slower.
  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin
    No idea I'm afraid, but it does sound like the issue is with the server-side script rather than DataTables. Perhaps it is doing complex joins or something?

    Allan
  • jamesjw007jamesjw007 Posts: 35Questions: 0Answers: 0
    Yeah I have concluded it is probably the script. Which is weird because in SQL it will run super quick. It isn't until the same script is run on the page that it takes 20+ seconds. This one will be fun to figure out. :)
This discussion has been closed.