Home Forums WoodMart – Premium Template Uncached pages slow response time – Response from my hosting provider

This topic contains 9 replies, has 2 voices, and was last updated by gevcen gevcen 4 days, 20 hours ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #165664
    gevcen
    gevcen
    Customer

    Dear,

    I’ve been in contact with my hosting provider to analyze the slow response time on UNCACHED pages of my site, and they provided me some insights which I’d like you to read in private section.

    Is there something you can do to resolve this?

    Thanks

    Private Content Hidden
    #165976
    gevcen
    gevcen
    Customer

    Dear,

    If needed, they provided me an external blog post where the same steps to reproduce those commands are explained in details. That’s just in case you want to know how those data were generated.

    https://guides.wp-bullet.com/using-wp-cli-wp-profile-to-diagnose-wordpress-performance-issues/

    Thanks

    #165699

    Hello,

    Most of these problems are general WordPress problems. As we can see, problems related to our theme are connected to the main loop and menu. Both menus and main loop use standard WordPress posts queries. Usually, it happens when your database is overloaded and your server can’t handle it. Your mobile menu has a lot of links and, in WordPress, each link is a separate post. So loading a lot of posts seems to take a lot of time on your environment. But it is not something that we really can fix in our theme.

    Kind Regards

    #168805
    gevcen
    gevcen
    Customer

    Dear,

    On this same topic, I have some more information to forward you, on which I’d like your feedback to. The support team of WPML has made some research and provided me the below shortcode that is supposed to improve the performance between WPML and Woodmart theme, to be added in child theme functions.php

    Could you tell me what you think about this code? Is there anything related which could be improved by Woodmart ?

    Thanks

    if( ! function_exists( 'woodmart_autoload' ) ) {
        function woodmart_autoload($className) {
            global $woodmart_files;
     
            $className = ltrim($className, '\\');
            $fileName  = '';
            $namespace = '';
            if ($lastNsPos = strripos($className, '\\')) {
                $namespace = substr($className, 0, $lastNsPos);
                $className = substr($className, $lastNsPos + 1);
                $fileName  = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
            }
            $className = str_replace('WOODMART_', '', $className);
            $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
            $fileName = get_template_directory() . '/inc/classes' . DIRECTORY_SEPARATOR . $fileName;
            $fileName = str_replace( '\\', '/', $fileName );
     
            if ( ! in_array( $fileName, $woodmart_files, true ) ) {
                return;
            }
     
            if( file_exists( $fileName )) {
                require $fileName;
            }
        }
     
        global $woodmart_files;
     
        $woodmart_files = glob( get_template_directory() . '/inc/classes/*.php' );
        $woodmart_files = array_map(
                function( $file ) {
                    return str_replace( '\\', '/', $file );
                },
            $woodmart_files
        );
     
        spl_autoload_register('woodmart_autoload');
    }
    Private Content Hidden
    #168858

    Hello,

    We don’t quite understand what this code should do with the performance. Could you please explain what speed increase did you get when added the code? We don’t see any difference in our case.

    Kind Regards

    #168933
    gevcen
    gevcen
    Customer

    Hi Artem,

    The support team from WPML says the following :

    This spl_autoloader hook is called by php when any class is instantiated. In plugins, we have a lot of classes, so this hook woodmart_autoload is called some 5,000 times during page load. It would be OK, but code of this hook in the main theme has an issue: on every call it checks if file_exists() in theme own directory. File operation is slow, and not needed.
    My modification creates first list of all classes in woodmart theme directory (there are only 14 as I recall), and then checks if file_exists only for 14 files. In other (5000-14) calls function just simply and quickly does nothing.

    Just to clarify, no action is expected on your side. However, I forward you this information because they indicate that this will include this code in WPML plugins, to improve their plugin’s performance specifically for those who have Woodmart theme.

    Thanks

    #168937

    OK, thank you. We will rework this in our next theme update.

    #175044
    gevcen
    gevcen
    Customer

    Hi Artem,

    You indicated in this ticket that you’ll rework this issue, can I consider this completed with the last release? If yes, please close this ticket.

    Thanks

    #175065

    Yes, we have removed that function and reworked this functionality as promised.

    #175078
    gevcen
    gevcen
    Customer

    Perfect thanks

    Please close this ticket

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Uncached pages slow response time – Response from my hosting provider’ is closed to new replies.