nystudio107 / craft-seomatic

SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.
https://nystudio107.com/plugins/seomatic
Other
165 stars 70 forks source link

Remove `$debugModule` for performance tuning #1416

Closed markhuot closed 7 months ago

markhuot commented 7 months ago

When performance tuning it can be helpful to use the timeline view or the DB tab of the debug bar. Removing this code allows you to use the debug bar and get realistic numbers from the profiler.

I realize this is probably a breaking change, so if you'd rather I replace it with a config option or some other user-configurable heuristic, let me know and I can adjust the PR.

khalwat commented 7 months ago

Yeah, I think the thing to do here is make it a setting so that people can turn it off if they don't want the SEOmatic debug toolbar visible or impacting things for performance timings.

markhuot commented 7 months ago

That makes sense.

To make sure I'm understanding everything correctly: the code in the PR as it currently stands only affects the meta containers pulling from the cache or not. That wouldn't affect the debug toolbar visibility, right? In my testing, even with this if() forced to false so the else runs every time, I still get what I would expect in the preview panel.

Regardless, would you accept a config/seomatic.php setting along the lines of 'enableDebugMode' => true|false? It could default to true meaning use the existing functionality. But, if enableDebugMode is false then it would not skip the cache (like this PR) and it would also hide the Seomatic debug panel.

khalwat commented 7 months ago

Well, what's going to happen is the SEOmatic debug toolbar won't be able to collect any of the diagnostic information it needs if it is coming from the cache.

So your PR will cause the SEOmatic debug toolbar to not function properly if the SEOmatic data comes from the cache.

I've been wanting to put a setting in there anyway so people can decide whether they want the debug toolbar pane or not.

khalwat commented 7 months ago

I implemented this via a setting in Plugin Settings -> Advanced

Craft CMS 3:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-seomatic": "dev-develop as 3.4.72”,

Then do a composer clear-cache && composer update

…..

Craft CMS 4:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-seomatic": "dev-develop-v4 as 4.0.41”,

Then do a composer clear-cache && composer update

…..

Craft CMS 5:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-seomatic": "dev-develop-v5 as 5.0.0-beta.5”,

Then do a composer clear-cache && composer update

markhuot commented 5 months ago

Lovely, thanks!