Opened 7 years ago
Last modified 2 months ago
#41520 assigned enhancement
Disable deprecated functions
Reported by: | spacedmonkey | Owned by: | pbearne |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bootstrap/Load | Keywords: | has-patch dev-feedback |
Focuses: | performance | Cc: |
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)
Change History (13)
#3
@
7 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
@
7 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
@
7 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.
7 years ago
#7
@
7 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
.
This ticket was mentioned in Slack in #core-multisite by spacedmonkey. View the logs.
7 years ago
#11
@
5 months ago
- Owner set to pbearne
- Status changed from new to assigned
Is this something WP_CLI or WP_JSON could always not load or turn off by default?
I am happy to refresh this code
#12
@
2 months ago
I'm a bit worried about the effects that something like this would have on autoupdates. Namely, if a function is deprecated and a site is using the proposed constant then auto-updates could either fail or cause a fatal error for a site (depending on how they are used). This essentially means we can never deprecate a function in a minor release. It's rare, but it has been done as recently as 6.0.3 [54524].
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:Even if these numbers are not 100% accurate, it should be safe to assume that this change is an improvement.