Defer parsing of javascript makes site very slow

This topic has 4 replies, 2 voices, and was last updated 6 years, 10 months ago ago by Laranz

  • Avatar: andantesash
    andantesash
    Participant
    June 21, 2017 at 01:27

    I’ve been testing out various changes on my site because on average it’s loading around 6-8 seconds so I am trying to lower it.

    GT Metrix suggests defer parsing of javascript so I used this;
    http://www.laplacef.com/2014/05/24/how-to-defer-parsing-javascript-in-wordpress/

    // Defer jQuery Parsing using the HTML5 defer property
    if (!(is_admin() )) {
        function defer_parsing_of_js ( $url ) {
            if ( FALSE === strpos( $url, '.js' ) ) return $url;
            if ( strpos( $url, 'jquery.js' ) ) return $url;
            // return "$url' defer ";
            return "$url' defer onload='";
        }
        add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
    }

    My load time suddenly began 54 seconds, can you please look at my site and see if you can figure out what is wrong with it

    Please, contact administrator
    for this information.
    3 Answers
    Avatar: laranz
    Laranz
    Participant
    June 21, 2017 at 09:07

    Hi,

    What if you remove the code you added to defer parsing JS? Did the site speed back to 5-6 seconds from the 54seconds?

    PS: The article you’re trying is 3years old, and the filter used in that clear_url is also deprecated. So try some new solution or try using any Cache plugin, that will help you to reduce loading time, instead tackling each issue separately.

    Let us know,

    Thanks,
    laranz.

    Avatar: andantesash
    andantesash
    Participant
    June 21, 2017 at 16:34

    When I remove the code and rescan the site its back to 5-6 seconds. I tried a plugin on the site but it slows it down to around 12-13 seconds.

    I have attached the link to the report to see what you can recommend on speeding up this.

    I activated TwentySeventeen theme and ran GTMetrix and it loaded in 1.7seconds, I switch back to Royal and GT Metrix jumps up 12.7seconds.

    Please, contact administrator
    for this information.
    Avatar: laranz
    Laranz
    Participant
    June 22, 2017 at 01:45

    Hi,

    I tried now and it says 6seconds, TwentySeventeen has low loading rates because it is not a multipurpose WordPress theme, my suggestion is to try some CDN ( optional 0 and also a good Cache plugin, that will resolve most of the issue you’re telling. Please try a cache plugin and wait for sometime to see the speed effects.

    Let us know,

    Thanks,
    laranz.

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.