Make WordPress Core

Opened 10 years ago

Closed 10 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:

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)

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

Download all attachments as: .zip

Change History (4)

#1 @DrewAPicture
10 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
10 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.

@santagada
10 years ago

benchmarks

Note: See TracTickets for help on using tickets.