• Resolved MrPeteH

    (@mrpeteh)


    Googles PageSpeed Insights and GTMetrix PageSpeed/YSlow both scream loudly about poor page-load times through default use of this plugin. This is completely independent of any data!

    They also explain the issue:

    The static-loaded scripts (yes, even from CDN’s) introduce huge page-load blocking delays. Google measures the delay at ten seconds! AND, they show exactly which scripts are causing the pain.

    I implemented a full set of the suggested dequeue methods, allowing me to pretty easily test and see if Google is correct. They are. My Google score went from 10 (awful) to 80 (not bad). GTMetrix eliminated both “F” scores from my page load. And I lost zero functionality of interest for this site!

    Below:
    * Results of my testing.
    * A more complete script people can insert into their theme functions.php
    * A suggestion for improving this plugin if the creator can find some ’round tuits ?? ??

    I hope this will be helpful for others.

    Blessings,
    Pete

    TEST RESULTS
    – Removing PDF export scripts eliminated 7 seconds of render-blocking delay
    – Removing Excel export scripts eliminated another 1+ sec.
    – Removing the duplicate jquery load (WP already uses jquery) and charts eliminated about 1/2 sec more.

    A SCRIPT TO INSERT IN THEME FUNCTIONS.PHP

    
    // for gdoc, remove unneeded scripts and css
    //
    function gdoc_dequeue_misc_table_scripts ($scripts) {
    // Avoid duplicate jquery load 
    // (only disable if your WP doesn't already load... I have never seen a site w/o jquery already :) )
        unset($scripts['jquery-datatables']);
    	
    //    unset($scripts['datatables-buttons']);
    //    unset($scripts['datatables-buttons-colvis']);
    //    unset($scripts['datatables-buttons-print']);
    
    //    For PDF export:
        unset($scripts['pdfmake']);
        unset($scripts['pdfmake-fonts']);
        unset($scripts['vfs-fonts']);
    
    //    For Excel export:
        unset($scripts['jszip']);
        unset($scripts['datatables-buttons-html5']);
      
    //    unset($scripts['datatables-select']);
    //    unset($scripts['datatables-fixedheader']);
    //    unset($scripts['datatables-fixedcolumns']);
    //    unset($scripts['datatables-responsive']);
    //    unset($scripts['igsv-datatables']);
    //    unset($scripts['google-ajax-api']);
        unset($scripts['igsv-gvizcharts']);
        return $scripts;
    }
    function gdoc_dequeue_misc_table_styles ($styles) {
    //    unset$styles['jquery-datatables']);
    //    unset$styles['datatables-buttons']);
    //    unset$styles['datatables-select']);
    //    unset$styles['datatables-fixedheader']);
    //    unset$styles['datatables-fixedcolumns']);
    //    unset$styles['datatables-responsive']);
        return $styles;
    }
    add_filter('gdoc_enqueued_front_end_scripts', 'gdoc_dequeue_misc_table_scripts');
    add_filter('gdoc_enqueued_front_end_styles', 'gdoc_dequeue_misc_table_styles');
    
    

    SUGGESTION FOR THIS PLUGIN

    Eventually, why not implement a settings UI that allows simple site-wide enable/disable of various big picture DataTables features? By default, you could leave PDF and Excel export disabled, and datatables-jquery as well since it would be rare to need it in the WP context.

    • This topic was modified 4 years, 10 months ago by MrPeteH.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Meitar

    (@meitar)

    Eventually, why not implement a settings UI that allows simple site-wide enable/disable of various big picture DataTables features? By default, you could leave PDF and Excel export disabled, and datatables-jquery as well since it would be rare to need it in the WP context.

    Why not? Because it isn’t worth my time given the fact that I am not paid to do this. If I made more money from this plugin, then it would make sense to spend more of my resources (e.g., time) on it.

    Other than that, the solution you’ve posted is the same as has been in the FAQ for many years.

    Thread Starter MrPeteH

    (@mrpeteh)

    No need to be defensive, Meitar. I understand about labors of love vs earning… having built a few myself over the years! What you have done is MUCH appreciated. THANK YOU again!

    The only differences w/ my solution:
    * It is plug-and-play, with every script and style already in place, and just needs to be enabled/disabled. Common elements that cause slowdown are already disabled.
    * It is documented w/ respect to which ones accomplish what purpose for the most part.
    * It is more complete, including all of the scripts and styles — BTW “vfs-fonts” is missing from the docs list. ?? )

    I am just trying to help, not make trouble ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Page Load Performance: issues, solution, suggestion’ is closed to new replies.