Ticket #5458 (closed defect: fixed)

Opened 1 year ago

Last modified 9 months ago

making get_pages and wp_list_pages faster

Reported by: hailin Assigned to: ryan
Priority: normal Milestone: 2.5
Component: Optimization Version:
Severity: normal Keywords: has-patch needs-testing
Cc:

Description

When there are a lot of pages, these functions slow down quite a bit. Should improve on the algorithm so that they speed up. (using logic similar to 5303).

Attachments

5458_walk_core.diff (7.3 kB) - added by hailin on 12/14/07 01:30:43.
patch
no_hier_pages.diff (426 bytes) - added by ryan on 12/14/07 22:01:00.

Change History

12/12/07 03:15:22 changed by hailin

  • owner changed from anonymous to hailin.
  • status changed from new to assigned.

12/14/07 01:13:22 changed by hailin

Per Ryan's request, I've rewrote the Walk class which is a core class used in wp_list_pages, etc to generate nested pages.

The resulting implemenation is much faster, with O(N) time complexity. and the code is more simple, thus easier to understand and maintain.

Tested on my local wporg and wpcom sandbox.

12/14/07 01:30:43 changed by hailin

  • attachment 5458_walk_core.diff added.

patch

12/14/07 07:32:10 changed by ryan

Working well in my tests. Now we can set hierarchical to false when calling get_pages() and get_terms() to avoid the hierarchy sorting done in those functions. Actually, get_terms() will require some finesse because it does some things to counts for term hierarchies.

12/14/07 21:46:53 changed by ryan

(In [6384]) Faster page and cat walker. Props hailin. see #5458

12/14/07 22:01:00 changed by ryan

  • attachment no_hier_pages.diff added.

12/14/07 22:02:13 changed by ryan

Small patch that calls get_pages() with heirarchical set to 0 since the new walker code doesn't need get_pages() to pre-sort the results. Need to profile this with lots of pages.

12/14/07 22:48:31 changed by lloydbudd

  • milestone changed from 2.5 to 2.4.

12/17/07 06:53:59 changed by ryan

(In [6399]) wp_list_pages() no longer requires get_pages() to do a hierarchical sort. Set hierarchical to false. see #5458

12/28/07 04:31:57 changed by darkdragon

  • component changed from General to Optimization.

I think this should be moved to optimization, so I'm moving this to that category.

01/13/08 15:34:16 changed by hansengel

  • keywords set to has-patch needs-testing.

01/14/08 04:44:11 changed by ryan

  • owner changed from hailin to ryan.
  • status changed from assigned to new.

02/13/08 18:32:16 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.