Opened 15 years ago
Closed 15 years ago
#10972 closed enhancement (fixed)
Improve sanitize_post() calling
Reported by: | johanee | Owned by: | |
---|---|---|---|
Milestone: | 2.9 | Priority: | normal |
Severity: | normal | Version: | 2.9 |
Component: | Performance | Keywords: | has-patch |
Focuses: | Cc: |
Description
http://core.trac.wordpress.org/changeset/11282 resulted in a 5% performance regression.
sanitize_post() is called on every get_post(), which is used almost everywhere such as in commonly-called template functions (the_title, get_permalink, etc.).
A better solution than reverting the commit is to call sanitize_post() once only for a post: before storing in wp_cache_add() and for wp_query->posts. Instead of for example 16 times for each post in default theme.
This patch restores the performance lost by changeset 11282.
Attachments (4)
Change History (14)
#2
@
15 years ago
- Summary changed from Changeset 11282 performance regression - and no need to sanitize_post more than once to Improve sanitize_post() calling
#3
@
15 years ago
Perhaps we can move the loop from _sanitize_the_posts() directly into WP_Query::get_posts(). That way it is run even if filters are suppressed and we avoid the pass by value overhead incurred by anything attached to a filter.
Only sanitize_post() once