You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
On our sites with big databases, sitemap generation is a performance problem. We've located a possibility for significant improvement.
Short explanation: there is a method WPSEO_Sitemaps::get_last_modified_gmt(). It gets called a lot of times while sitemaps are generated, and triggers a heavy database query. It is cached internally, memoized. However, that cache gets invalidated several times during sitemap generation, and the method repeats exactly the same heavy database query several times.
This is the code block that invalidates the cache:
foreach ( $post_typesas$post_type ) {
if ( ! isset( $post_type_dates[ $post_type ] ) ) { // If we hadn't seen post type before. R.$post_type_dates = null;
break;
}
}
Here's the catch - invalidating the cache is based on the parameters that are not used in the query itself. So, it looks pointless to me - cache is invalidated, and then exactly the same query is triggered which produces exactly the same results which are put back into cache.
Simply deleting this cache invalidation part produces the same sitemap in about half the time. Huge performance improvement.
Describe the solution you'd like
Two possible things that would help us:
Review this cache invalidation and, if I'm not missing something, it's pointless, and it could be removed or reworked.
If option 1 is not an option, add a filter that we could hook into to turn this cache invalidation off for our sites.
Why do you think this feature is something we should consider for the Yoast SEO plugins?
It would probably help all sites with lots of content.
The text was updated successfully, but these errors were encountered:
Thanks for using the Yoast SEO plugin and for creating this issue. Our development team will look into the details shared over here and will get back to you.
Is your feature request related to a problem? Please describe.
On our sites with big databases, sitemap generation is a performance problem. We've located a possibility for significant improvement.
Short explanation: there is a method
WPSEO_Sitemaps::get_last_modified_gmt()
. It gets called a lot of times while sitemaps are generated, and triggers a heavy database query. It is cached internally, memoized. However, that cache gets invalidated several times during sitemap generation, and the method repeats exactly the same heavy database query several times.This is the code block that invalidates the cache:
Here's the catch - invalidating the cache is based on the parameters that are not used in the query itself. So, it looks pointless to me - cache is invalidated, and then exactly the same query is triggered which produces exactly the same results which are put back into cache.
Simply deleting this cache invalidation part produces the same sitemap in about half the time. Huge performance improvement.
Describe the solution you'd like
Two possible things that would help us:
Why do you think this feature is something we should consider for the Yoast SEO plugins?
It would probably help all sites with lots of content.
The text was updated successfully, but these errors were encountered: