Okay
  Public Ticket #2217278
Performance
Closed

Comments

  •  2
    gehess started the conversation

    Hi guys,

    contacted you before with a similar topic, but this time more general.

    Testing my page with pingdom tools(gt metrix, the performance changes form 479ms to 1.2s when your plugin is activated. Even more, requests increase form 45 to 106. 

    That seems quite a lot for just 1 plugin tough I like your calendar very much und would hate to dismiss it. 

    Adjusting js seetings with WP Rocket does help shortly but sooner or later crashes the calendar. 

    Is this performance behaviour a know issue or normal and do you provide any recommendations for optimization with wp rocket for example?

    Thx a lot!

  •  894
    Zhivko replied

    Calendar has a lot of scripts indeed each providing extra feature.

    I see on your site you're not using much of it.

    What you could try is to compress the javascript files into a single file.

    Another thing that comes on my mind is to deregister the unused scripts although this has to be tested to ensure we're not breaking something fundamental.

    Here's how to remove the unused scripts:

    // Deregister unused scripts
    add_action('wp_enqueue_scripts', function() {     global $post;     if (is_a($post, 'WP_Post') && has_shortcode($post->post_content, 'stachethemes_ec')) {
            $scripts = array(
                'stec-reminder-js',
                'stec-rsvp-js',
                'stec-schedule-js',
                'stec-guests-js',
                'stec-attendance-js',
                'stec-comments-js',
                'stec-forecast-js',
                'stec-location-js',
                'stec-event-create-js',
                'stec-builder-submission-js',
                'stec-sharer-js'
            );         foreach ($scripts as $handle) {
                wp_deregister_script($handle);
            }
        }
    }, 9999); // Adding dummy functions for the sake of not breaking stec.js 
    add_action('stec_after_html', function() {
        ?>
        <script type="text/javascript">
            (function ($) {             $.fn.datepicker = function () {}; // if your site has datepicker then remove this one                         window.StecReminder = function () {
                    this.set = function () {
                        return this;
                    };
                    this.controller = function () {};
                };             window.StecRsvpToEvent = function () {
                    this.set = function () {
                        return this;
                    };
                    this.controller = function () {};
                };         })(window.jQuery);
        </script>
        <?php
    });


    Stachethemes Developer