WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 22 months 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:
PR Number:

Description

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 2 years ago.

Download all attachments as: .zip

Change History (10)

@spacedmonkey
2 years ago

#1 @spacedmonkey
2 years ago

  • Keywords dev-feedback added

#2 @schlessera
2 years 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
2 years 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
2 years 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
2 years 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 years ago

#7 @LewisCowles
2 years 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 years ago by LewisCowles (previous) (diff)

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


2 years ago

Note: See TracTickets for help on using tickets.