Page Load Performance: issues, solution, suggestion
-
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,
PeteTEST 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.
- The topic ‘Page Load Performance: issues, solution, suggestion’ is closed to new replies.