Page loading slowly - high "idle" time

Page loading slowly - high "idle" time

dajones12dajones12 Posts: 5Questions: 3Answers: 0

Hello,
I'm struggling to figure out why my webpage is loading slowly. It's taking about 17 seconds to load, while the stored procedure in Sql Server which the data is being pulled from takes about 5 seconds. I've tried using the Chrome Dev tool to help find the cause, and notice the "idle" time is high (8.3 seconds). I've also noticed that I'm getting an error for "d" that says "Not optimized: TryCatchStatement". I'm very new to all this and have no idea if this could be the source of the slow down. Please see the attached image for more details. A snippet of my code is as follows:

         $(document).ready(function() {
             $('#webpage_ajax').dataTable( {
                "sAjaxSource": "content/webpage_ajax.php?startdate=<?php echo $startdate;?>&enddate=<?php echo $enddate;?>&branch=<?php echo $branch;?>",
                "bPaginate": false,
                "processing": true,
                "paging": true,
                "bDeferRender": true, 
                "bAutoWidth": true,
                "bScrollCollapse": true,
                "sScrollY": "50vh",
                "bStateSave": true,
                "sDom": '< TC > ftiS',
                "oTableTools": {
                    "sSwfPath": "js/copy_csv_xls.swf",
                    "aButtons": [
                        "copy",
                        "print",
                        {
                            "sExtends":    "collection",
                            "sButtonText": "Save",
                            "aButtons":    [ "xls" ]
                        }
                    ]
                },
                "fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {

                                var iPrice = 0;
                                for ( var i=0 ; i<aiDisplay.length  ; i++ ) {
                                    var y = aaData[ aiDisplay[i] ][13];
                                    var z = y.replace("$","");
                                    iPrice +=  parseFloat(skipComma(z));
                                }

                                var nCells3 = nRow.getElementsByTagName('th');
                                nCells3[13].innerHTML = "$"+addCommas(iPrice.toFixed(2)); 

                                var iTotalPrice = 0;
                                for ( var i=0 ; i<aiDisplay.length  ; i++ ) {
                                    var y = aaData[ aiDisplay[i] ][14];
                                    var z = y.replace("$","");
                                    iTotalPrice +=  parseFloat(skipComma(z));
                                }

                                var nCells = nRow.getElementsByTagName('th');
                                nCells[14].innerHTML = "$"+addCommas(iTotalPrice.toFixed(2)); 
                                

                            }  
            } ).fnSetFilteringDelay();
        } );

Any help is greatly appreciated. Please let me know if I need to clarify anything or provide more information.

Thanks

Answers

  • allanallan Posts: 63,815Questions: 1Answers: 10,517 Site admin

    Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.

    Information on how to create a test page, if you can't provide a link to your own page can be found here.

    Thanks,
    Allan

This discussion has been closed.