Open
Conversation
|
Test on Playground |
Collaborator
Author
|
I have implemented 3. - the update interval is 5 minutes (but it is filterable). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We got a report from the user that the plugin slowed down his site, by investigating I found that we do
get_option( 'option_optimizer' )on every page load inregister_hooksmethod. The reason was to set theaccessed_optionsarray.Fetching options shouldn't be necessary on every page load, especially not that early, so I have replaced initial value of
accessed_optionswith empty array. Then onshutdownhook, after the page was loaded for the user,option_optimizerentry is updated with the collected data.This should speed up the page loading for the user as is, but there are still some room for improvement:
Both align with Settings page which is added in #59 (comment)
wp_optionentry. Then after some time interval (every hour?) we updateoption_optimizer(which can be much larger) with collected data. The downside is that the stats would be updated with a delay, but if plugin is collecting data 24/7 then it maybe is not that important.