[wp-trac] [WordPress Trac] #45804: Make WP_Hook gather callback performance information
WordPress Trac
noreply at wordpress.org
Tue Jan 29 17:19:35 UTC 2019
#45804: Make WP_Hook gather callback performance information
-------------------------+------------------------------
Reporter: Rarst | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version:
Severity: normal | Resolution:
Keywords: | Focuses: performance
-------------------------+------------------------------
Comment (by Rarst):
I've run a rough benchmark with 1 hook x 5 lightweight callbacks x 10,000
executions = 50,000 callback runs.
On my machine this goes from 19ms to 2.8s (memory goes up by several
megabytes, but fluctuates a lot).
While if you are firing 50K real–world callbacks — you probably have
bigger problems, nevertheless this is probably too heavy to just enable.
Constant opt–in then.
Also while playing with this I realized that my initial suggestion is a
little too granular. It works well if I ''already know the hook'' I am
interested in. But it doesn't work well for easily answering questions
like "''which'' hooks were slower than N ms".
I think collection should also capture same metrics (start time and
duration) for overall hook execution. This will give two levels of
granularity to easily detect both hooks and callbacks worth attention.
Will start on a patch and see if anything else comes up.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45804#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list