[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 13:17:44 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
-------------------------------------------+--------------------------
Comment (by SergeyBiryukov):
Replying to [comment:16 kovshenin]:
> I don't see a 15% increase with or without the patch. I ran a
[https://gist.github.com/kovshenin/2bcd348dbc77281d7bc7 few benchmarks]
with 1000 calls to get_permalink() which passes an object vs id to
get_page_link(), I don't see a significant increase or decrease in
performance.
I'd suggest trying 100 000 calls for more consistent results.
Here's my test file: [attachment:28425.test.php]. I do see a consistent
difference on both PHP 5.2.17 and 5.4.29:
{{{
// PHP 5.2.17, 1000 calls
get_permalink(): 0,225 seconds
get_permalink_with_obj(): 0,177 seconds
// PHP 5.2.17, 100 000 calls
get_permalink(): 22,158 seconds
get_permalink_with_obj(): 17,931 seconds
// PHP 5.4.29, 1000 calls
get_permalink(): 0,125 seconds
get_permalink_with_obj(): 0,094 seconds
// PHP 5.4.29, 100 000 calls
get_permalink(): 12,422 seconds
get_permalink_with_obj(): 9,406 seconds
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28425#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list