Opened 10 years ago
Closed 10 years ago
#31411 closed enhancement (duplicate)
Make get_page_children much faster
Reported by: | santagada | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.2 |
Component: | Posts, Post Types | Keywords: | reporter-feedback has-patch |
Focuses: | performance | Cc: |
Description
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)
Change History (4)
Note: See
TracTickets for help on using
tickets.
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.