[wp-trac] [WordPress Trac] #50567: Set $post filter in update_post_cache()
WordPress Trac
noreply at wordpress.org
Thu Jul 30 13:13:41 UTC 2020
#50567: Set $post filter in update_post_cache()
-------------------------------+--------------------------
Reporter: Cybr | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.6
Component: Posts, Post Types | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses: performance
-------------------------------+--------------------------
Comment (by Cybr):
@peterwilsoncc asked me in Slack if I could post fuller screenshots
(`50567.png`) pertaining to this ticket.
Attached (`cg.zip`) are before and after CacheGrind outputs generated by
xDebug on PHP 7.4.7 via XAMPP on a VM with generous overhead
(16GB/4x3.8GHz).
I've used Twenty Twenty with no plugins active on WP 5.4.2 en_US,
displaying 20 posts (duplicated default post "Hello World!") at `/wp-
admin/edit.php`, and 10 posts at `/` (homepage).
To learn how to inspect the files, see https://xdebug.org/docs/profiler. I
used [https://sourceforge.net/projects/qcachegrindwin/ QCacheGrind] to
generate the attached screenshot.
1 unit of Incl./Self/Time is equal to 1 microsecond (0.001ms).
The attached screenshot shows the grind's output in this order:
Home Before / Home After
Admin Before / Admin After
[[Image(https://core.trac.wordpress.org/raw-
attachment/ticket/50567/50567.png)]]
At the bottom-left of each window in the screenshots, you can see the
Total Time Cost to generate the page. Since we can't use opcode caching
during debugging, file inclusion takes up a generous amount of time. So,
you can't calculate the relative performance impact of the improvements to
the total page generation time. Nevertheless, you can measure a
significant boost there, too.
||= =|| sanitize_post_field |||| Called |||| Microtime |||| Seconds ||
Improvement ||
||= =|| Location || Before || After || Before || After || Before || After
|| =-1*((Af-Be)/Be) ||
|| (logged out) || / || 4 554 || 276 || 100 911 || 6 110 || 0.101 || 0.006
|| 94% ||
|| (logged in) || /wp-admin/edit.php || 12 443 || 483 || 272 566 || 10 372
|| 0.273 || 0.011 || 96% ||
So, we can assume almost up to 0.3s improved response times using PHP 7.4,
implying a total of 62% of the total page load time.
You'll notice from the same CacheGrind files, `sanitize_term_field()` is
also affected by this issue, where category ID 1 is resanitized over and
over again. To accommodate for that, see #50568.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50567#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list