[wp-trac] [WordPress Trac] #35025: Performance regression in comments_template in 4.4
WordPress Trac
noreply at wordpress.org
Fri Dec 11 22:09:14 UTC 2015
#35025: Performance regression in comments_template in 4.4
--------------------------+-----------------------------
Reporter: rogerhub | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: 4.4
Severity: normal | Keywords:
Focuses: performance |
--------------------------+-----------------------------
I'm experiencing a significant performance regression from the 4.4
upgrade, related specifically to this code in wp-
includes/comment_template.php in the comments_template() function:
{{{#!php
<?php
$comment_query = new WP_Comment_Query( $comment_args );
$_comments = $comment_query->comments;
// Trees must be flattened before they're passed to the walker.
$comments_flat = array();
foreach ( $_comments as $_comment ) {
$comments_flat = array_merge( $comments_flat, array( $_comment ),
$_comment->get_children( array(
'format' => 'flat',
'status' => $comment_args['status'],
'orderby' => $comment_args['orderby']
) ) );
}
}}}
The call to $_comment->get_children seems to generate a query for every
top-level comment in a post. This seems to be new code introduced in 4.4.
I don't have much context on the new comment caching stuff, but is there
any way these queries can be avoided, especially for sites that don't even
use nested comments?
For more context, I'm experiencing these issues on a page that has 7000+
comments, and for various reasons, they can't be paginated.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35025>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list