Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow Classes? #8637

Closed
rochow opened this issue Jul 22, 2015 · 2 comments
Closed

Slow Classes? #8637

rochow opened this issue Jul 22, 2015 · 2 comments

Comments

@rochow
Copy link
Contributor

rochow commented Jul 22, 2015

content-product.php

<li <?php post_class( $classes ); ?>>

Search results with this line of code: 15 seconds
Search results without: 5 seconds

Large database (about 40mb posts, 250mb post meta), but why does this seemingly basic function increase the time so much? PHP too not SQL, would make sense if it was doing lots of relationship queries or something (have "debug queries" installed which is where I'm getting figures).

On dev I trashed everything; literally WordPress, TwentyFifteen & WooCommerce left active. Same solution works on both dev & live with the same drastic results.

Thoughts?

@rochow
Copy link
Contributor Author

rochow commented Jul 23, 2015

This is an example class, "post-110843 product type-product status-publish has-post-thumbnail product_cat-gun-cases taxable shipping-taxable purchasable product-type-simple product-cat-gun-cases instock"

Built in WP function but not sure on the benefit of having it vs the huge cost it appears to have as soon as a site starts getting sizeable?

@claudiosanches
Copy link
Contributor

In WooCommerce side we just add a feel more classes: https://github.com/woothemes/woocommerce/blob/ab61c8fa881c49c7ca659107f638d0b994536d34/includes/wc-template-functions.php#L250-L319
Feel free for remove it from your store by using:

remove_filter( 'post_class', 'wc_product_post_class', 20, 3 );

Please let know if have some improvement and maybe we can think about something to improve this in the future, but we'll keep it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants