[wp-trac] [WordPress Trac] #28425: get_permalink passes only post ID to called functions instead of post object
WordPress Trac
noreply at wordpress.org
Wed Jun 25 03:44:01 UTC 2014
#28425: get_permalink passes only post ID to called functions instead of post
object
-------------------------------------------+--------------------------
Reporter: arnee | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.0
Component: Posts, Post Types | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch dev-feedback commit | Focuses: performance
-------------------------------------------+--------------------------
Changes (by SergeyBiryukov):
* keywords: has-patch dev-feedback close => has-patch dev-feedback commit
Comment:
Replying to [comment:10 arnee]:
> Actually, the get_instance method of WP_Post (which is called by
get_post if you only use the ID) will even create a new WP_Post object
every time it is read from the cache, since the cache contains the raw
data and not the WP_Post object.
While the use case might not exactly be valid (as mentioned above), this
sounds like a valid observation. Reusing the object we already have would
save us some overhead.
A quick test with 100,000 iterations shows a 15% performance increase
(21,281 seconds with [attachment:28425-1.diff] vs. 25,135 seconds
unpatched).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28425#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list