You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been investigating out client site, which seem to have few bottlenecks on the backend PHP processing, resulting in slow TTFB.
On my local site, using Blackfire as profiling tool, I found that deactivateLegacyPlugin() function of this plugin is one of the bottleneck, occupying up to around 15% (~450ms) of the php processing wall time.
To be more exact, it is the core get_plugins() function, called inside deactivateLegacyPlugin() that is taking the time (and memory).
I feel get_plugins() can be improved to better utilize object cache -- it seems retrieved cache is only utilized only when $plugin_folder parameter is specified. And this particular site has around 70 plugins which doesn't help the situation.
Nevertheless, I think it is unnecessary to check legacy "publishpress-content-checklist" in this way, every time the site is accessed, even on the frontend when user is not logged in.
Possible Solution
Idea 1
I think checking the legacy plugin only needs to happen once, when this new plugin is activated. So this can be called once inside register_activation_hook ?
Idea 2
Put it inside is_admin(). Also add a filter something like publishpress_skip_legacy_check, which when return true, skip deactivateLegacyPlugin() to run. So if a developer is sure that this legacy plugin is not installed, we can skip the function.
Your Environment
plugin ver 2.5.0 (I am aware this is not the latest, but 2.7.2 has the same code, so assuming same issue)
multisite
local environment is lando, with redis as persistant cache.
The text was updated successfully, but these errors were encountered:
I have been investigating out client site, which seem to have few bottlenecks on the backend PHP processing, resulting in slow TTFB.
On my local site, using Blackfire as profiling tool, I found that deactivateLegacyPlugin() function of this plugin is one of the bottleneck, occupying up to around 15% (~450ms) of the php processing wall time.
I checked this by commeinting out add_action.
PublishPress-Checklists/core/Plugin.php
Line 54 in 9e8659c
To be more exact, it is the core
get_plugins()
function, called insidedeactivateLegacyPlugin()
that is taking the time (and memory).I feel
get_plugins()
can be improved to better utilize object cache -- it seems retrieved cache is only utilized only when$plugin_folder
parameter is specified. And this particular site has around 70 plugins which doesn't help the situation.Nevertheless, I think it is unnecessary to check legacy "publishpress-content-checklist" in this way, every time the site is accessed, even on the frontend when user is not logged in.
Possible Solution
Idea 1
I think checking the legacy plugin only needs to happen once, when this new plugin is activated. So this can be called once inside
register_activation_hook
?Idea 2
Put it inside
is_admin()
. Also add a filter something likepublishpress_skip_legacy_check
, which when return true, skipdeactivateLegacyPlugin()
to run. So if a developer is sure that this legacy plugin is not installed, we can skip the function.Your Environment
The text was updated successfully, but these errors were encountered: