Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#31411 closed enhancement (duplicate)

Make get_page_children much faster

Reported by: santagada's profile santagada Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.2
Component: Posts, Post Types Keywords: reporter-feedback has-patch
Focuses: performance Cc:


This patch changes the algorithm get_page_children uses to a faster one. This old algo is both recursive (so at most depth 100 on common php vm) and exponential in time. The one proposed on the patch is linear and doesn’t use recursion, which is faster and doesn’t impose a theoretical limit on three depth.

Another idea is to rename the function to get_post_children as any custom post_type can be hierarchical, not only pages.

Attachments (2)

new_get_page_children.diff (1.4 KB) - added by santagada 9 years ago.
new_get_page_children.php (2.3 KB) - added by santagada 9 years ago.

Download all attachments as: .zip

Change History (4)

#1 @DrewAPicture
9 years ago

  • Keywords reporter-feedback has-patch added

Hi @santagada, welcome to Trac!

Normally we don't refactor for the sake of refactoring. However, if you could provide some benchmark data for the performance improvement, it would go a long way toward helping your argument for such a change.

#2 @helen
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #10852. Please do upload your patch there and provide benchmark figures if you can.

9 years ago


Note: See TracTickets for help on using tickets.