Make WordPress Core

Opened 3 weeks ago

Last modified 2 weeks ago

#41520 new enhancement

Disable deprecated functions

Reported by: spacedmonkey Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Bootstrap/Load Keywords: has-patch dev-feedback
Focuses: performance Cc:


In bootstrap process, deprecated.php, pluggable-deprecated.php and ms-deprecated.php are includes. These files include all the deprecated functions in core. This is done for compatibility reasons, however there are many setups that do not requires these functions as they are not using any of these functions. These files inline over 4500 lines of code ( 3881 + 208 + 518 ). There should be an option to disable them.

Attachments (1)

41520.diff (1.9 KB) - added by spacedmonkey 3 weeks ago.

Download all attachments as: .zip

Change History (8)

3 weeks ago

#1 @spacedmonkey
3 weeks ago

  • Keywords dev-feedback added

#2 @schlessera
3 weeks ago

I've run this simple change through the profiler.

I've done 3 50-samples runs on an empty site against the wp-json/wp/v2/posts endpoint. This gave me these numbers:

Wall Time     124ms   -14ms  -13.0%
CPU  Time     118ms   -13ms  -12.2%
I/O  Time    5.97ms -1.46ms  -32.3%
Memory       2.72MB   -648B     n/s
Network         n/a     n/a     n/a
SQL          4.67ms    13rq
Wall Time     124ms   -14ms  -12.5%
CPU  Time     118ms   -12ms  -11.9%
I/O  Time    6.11ms -1.32ms  -27.5%
Memory       2.72MB   -700B     n/s
Network         n/a     n/a     n/a
SQL          4.85ms    13rq
Wall Time     125ms   -12ms  -11.1%
CPU  Time     119ms   -11ms  -10.7%
I/O  Time     6.4ms -1.02ms  -19.1%
Memory       2.72MB   -706B     n/s
Network         n/a     n/a     n/a
SQL          5.04ms    13rq

Even if these numbers are not 100% accurate, it should be safe to assume that this change is an improvement.

#3 @schlessera
3 weeks ago

As the numbers seemed to be too good to be true, I re-ran the tests, with much more sober results.

The above was tested against an extremely bad reference measurement. It is actually difficult to test due to the OpCode cache.

Running multiple tests back and forth, it seems to average out at about 1.2% wall time improvement on my machine.

#4 @schlessera
3 weeks ago

Btw, the tests were run on PHP 7.0.20. I'd expect the improvements to be better on older PHP versions.

#5 @spacedmonkey
3 weeks ago

I think that even at 2-3% improvement is still work the time to investigate. The patch is very simple after all. It works in the current bootstrap process. Not sure how it works with autoloadinf etc.

This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.

2 weeks ago

#7 @LewisCowles
2 weeks ago

this might sound stupid, so apologies. But would it be possible to make stub functions than can be included if someone does enable, so that they can find in their dev-server logs the notices before pushing to staging or production?

It's literally cloning the function signatures, but having them raise a deprecated notice (since it's easy to grep or scan logs for that).

It would be different to existing deprecated message. Just saying the define from the attached patch has stopped loading functionname.

Last edited 2 weeks ago by LewisCowles (previous) (diff)
Note: See TracTickets for help on using tickets.