Home › Forums › WoodMart support forum › Uncached pages slow response time – Response from my hosting provider
Uncached pages slow response time – Response from my hosting provider
- This topic has 9 replies, 2 voices, and was last updated 4 years, 9 months ago by Jeriss Cloud Center.
-
AuthorPosts
-
December 30, 2019 at 11:30 pm #165664
Jeriss Cloud CenterParticipantDear,
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
January 2, 2020 at 4:44 pm #165976
Jeriss Cloud CenterParticipantDear,
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
January 3, 2020 at 8:08 am #165699
Artem TemosKeymasterHello,
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
January 19, 2020 at 3:35 pm #168805
Jeriss Cloud CenterParticipantDear,
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'); }
January 20, 2020 at 7:03 am #168858
Artem TemosKeymasterHello,
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
January 20, 2020 at 1:08 pm #168933
Jeriss Cloud CenterParticipantHi 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
January 20, 2020 at 1:23 pm #168937
Artem TemosKeymasterOK, thank you. We will rework this in our next theme update.
February 21, 2020 at 10:26 am #175044
Jeriss Cloud CenterParticipantHi 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
February 21, 2020 at 12:07 pm #175065
Artem TemosKeymasterYes, we have removed that function and reworked this functionality as promised.
February 21, 2020 at 12:20 pm #175078
Jeriss Cloud CenterParticipantPerfect thanks
Please close this ticket
-
AuthorPosts
The topic ‘Uncached pages slow response time – Response from my hosting provider’ is closed to new replies.
- You must be logged in to create new topics. Login / Register