[wp-trac] [WordPress Trac] #10852: improve get_page_children
WordPress Trac
wp-trac at lists.automattic.com
Tue Oct 6 23:19:22 UTC 2009
#10852: improve get_page_children
--------------------------+-------------------------------------------------
Reporter: hailin | Owner: westi
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 2.9
Component: Optimization | Version: 2.9
Severity: normal | Keywords: has-patch
--------------------------+-------------------------------------------------
Comment(by hailin):
If you refer to the standard wordpress-tests test cases, I didn't write or
add any new test cases.
What I did test was to put the code snippet in index.php, name the new
function as get_page_children2, and run against an existing page hierarchy
with ~100 nodes.
I verified results ($x) are the same before and with this patch, and the
new algorithm is significantly faster ($t)
$t1 = microtime(true);
$x = get_page_children( $id ); //adjust your id here
var_dump( $x );
$t2 = microtime(true);
$t = $t2 - $t1;
echo "it takes $t for the old get_page_children";
$t1 = microtime(true);
$x = get_page_children2( $id ); //adjust your id here
var_dump( $x );
$t2 = microtime(true);
$t = $t2 - $t1;
echo "it takes $t for the new get_page_children";
I took a look at the standard wordpress-tests cases, but couldn't not find
any existing cases that covers this particular function. If we were to
write some cases,
I think it'd better to write a comprehensive case to cover most of pages
functionalities.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10852#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list