Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#19175 closed defect (bug) (fixed)

Improve get_page_by_path() performance

Reported by: duck_'s profile duck_ Owned by: duck_'s profile duck_
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.3
Component: Performance Keywords: has-patch commit
Focuses: Cc:

Description

Follow up for #17670 where a few performance improvements were suggested.

I found an improvement of about 50% in some simplistic tests (loop over the function 10,000 times) by removing the $post_type parameter from the get_page() call. This was added in [13774]. The issue is that this is passing the post type to the filter argument which means that get_post() runs the relatively expensive sanitize_post().

Attachments (1)

19175.diff (336 bytes) - added by duck_ 13 years ago.

Download all attachments as: .zip

Change History (3)

@duck_
13 years ago

#1 @nacin
13 years ago

  • Keywords commit added
  • Milestone changed from Future Release to 3.3
  • Type changed from enhancement to defect (bug)

Per IRC. This is just a copy-paste error. Parameter never should have been passed.

#2 @duck_
13 years ago

  • Owner set to duck_
  • Resolution set to fixed
  • Status changed from new to closed

In [19283]:

Don't pass $post_type as get_page()'s $filter argument. Copy-and-paste error. Removal improves get_page_by_path() performance dramatically by stopping sanitize_post() being called. Fixes #19175.

Note: See TracTickets for help on using tickets.