Support » Plugin: Autoptimize » Slow backend page saving

  • Resolved chrism82

    (@chrism82)


    We’ve been debugging a slow page saving issue for a client, and have determined that with Autoptimize enabled it is adding 5-10s of delay to the process of saving a page in the backend (the time from clicking the ‘Update’ button to the page being fully reloaded).

    If we disable Autoptimize the delay is no longer present and the whole process takes approximately 5s versus 10-15s with Autoptimize enabled.

    The site is running Autoptimize 2.4.1 on WordPress 4.9.8.

    Is this a known issue and/or does anyone have any idea how to fix this?

    Thanks,
    Chris

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    Is this a known issue

    not to my knowledge no

    does anyone have any idea how to fix this?

    not off the top of my head, but we’ll get there. let’s start with AO settings; what optimizations (HTML, CSS, JS, Google Fonts, Images, …) do you have active and do you see any change when changing settings (e.g. when all optimizations are disabled)?

    frank

    chrism82

    (@chrism82)

    Thanks so much for your reply, Frank.

    Done some further testing in Troubleshooting Mode – it appears to be an incompatibility between Divi (the theme/builder) and Autoptimize. When we disable Autoptimize the saving delay doesn’t occur, and likewise when we disable Divi but enable Autoptimize it doesn’t occur.

    We’ve tested this with all options in Autoptimize disabled (everything unchecked).

    I guess i’m thinking if it’s possible to prevent Autoptimize from doing anything when saving a post/page, or is it necessary for it to do something at that point?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, that’s the surprising part; AO does not do a thing when a post/ page is saved … :-/

    chrism82

    (@chrism82)

    We found the issue in Divi’s codebase – the file wp-content/themes/Divi/core/components/init.php includes the following line:

    // Complimentary Performance Plugins
    // Autoptimize
    if ( is_callable( 'autoptimizeCache::clearall' ) ) {
    	autoptimizeCache::clearall();
    }

    This is being run whenever a post/page is saved hence the delay. If we comment out the code above the delay doesn’t occur.

    Do you know if there’s a better bit of code we could suggest that Divi use instead of the above? It would perhaps be better if the cache clearing was performed in the background instead of having the user wait while this was done.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    wow … I see absolutely no reason why Divi would need to clear AO’s cache for every page/ post created/updated. If JS or CSS changes AO will pick this up and create new optimized CSS/ JS. I would (like to ask you to) urge Divi not to do that at all really. They can always contact me via mail (futtta-at-gmail-dot-com) to exchange thoughts on the why & how of this approach!

    frank

    chrism82

    (@chrism82)

    We have been in touch with Elegant Themes support and have reported this issue to them. They responded with:

    I added this issue to our tracker so our development team can investigate. Unfortunately, there is no ETA on a solution that I can provide at this time. Though I can assure you that issues are addressed as quickly as possible based on our development team’s current workload and the severity of the issue when compared to the severity of other open issues.

    Please let me know if you have any further questions.


    Anupam from Elegant Themes

    Whether they fix this or not is another thing as they were reluctant to acknowledge the existence of anything to do with Autoptimize in their codebase.

    In the meantime the simple workaround for slow page saving when Autoptimize and Divi are used is to comment out the following line in wp-content/themes/Divi/core/components/init.php:

    autoptimizeCache::clearall();

    We will update here if we see any progress from Elegant Themes on this issue.

    Cheers,
    Chris

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Thanks for the feedback Chris, much appreciated! I’ll see if i can add to that! 🙂

    deepsikder

    (@deepsikder)

    I am a layman in coding. So, please tell me how to comment out that particular line of code. By the way can I do the changes by moving to the child theme folder.

    chrism82

    (@chrism82)

    Are you able to edit the file above? You can do this with the Editor from the WP admin or by downloading the file via FTP, make the changes, then re-upload.

    You would need to edit the specific file as mentioned previously – to comment out the line you need to add two forward slashes to the start of the line so it looks like the following:

    // autoptimizeCache::clearall();

    This will prevent the cache clearing routine from occurring.

    Hope this helps.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    @ all; do take into account that any change made will be overwritten with every theme update, so open tickets at Elegant Theme do get this broken behavior fixed!

    This has been going on for too long really … :-/

    Based on the lack of response from ET to this issue, they seem to be in no rush to resolve the problem. (They’ve also been touting how they’ve been making changes to optimize their code for speed.)

    Since Divi continues to take 3 seconds to get to first paint (!), could you please help those of us who are using Divi who don’t have time to migrate to a faster theme?

    I’d like to try to avoid having your recommended fix overwritten.

    To avoid overwriting or your recommended change, do we do the following:

    1. Create a blank init.php file
    2. Add “// autoptimizeCache::clearall();” to the file, without the quotes
    3. Add new init.php file to our Divi-child folder inside the directories: Divi-child/core/components/

    Thank you in advance for your kind assistance.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    I would rather copy the entire original init.php-file from wp-content/themes/Divi/core/components/init.php to wp-content/themes/Divi-Child/core/components/init.php and in there just comment out the autoptimizeCache::clearall() call? Do take into account you would have to re-copy and uncomment on every Divi-update though.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Slow backend page saving’ is closed to new replies.