-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache Autowiring::buildServiceClasses into a transient #440
Conversation
Thank you for the implementation; it’s a great idea! However, I wouldn’t make it a requirement to clear transients each time you deploy a manual thing. We already have manifest caching in the transients, along with cache busting based on the project version number and other factors. Since the Cache class is loaded before the Main class, I believe you could utilize the Cache class to get and set your transients effectively. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a comment about cache busting
Awesome, I wasn't familiar with how that class was implemented! ❤️ |
@mbmjertan and progress here, you need help? |
Hi, I didn't have the time to tackle this, hopefully I will today |
Refactored to use AbstractManifestCache and added basic support for caching custom objects in AbstractManifestCache (but maybe a generic concrete caching implementation in Libs would make sense in the future). Please test this before merging. |
Looks like it is working. I will make a prerelease from develop branch for testing |
We deployed this onto staging with no issues |
Description
Using profiling we've gathered that we spend a lot of time in
Autowiring::buildServiceClasses
. In particular, we spent 14% of the whole page generation time just running the method forEightshiftForms
.Here's a screenshot from an Excimer-grabbed profile opened up in Speedscope on my local machine:
I added caching this into a transient using the project namespace as a unique key. This requires transients to be cleared on all deployments, and can cause breakage if
manuallyDefinedDependencies
is changed dynamically at runtime. This should probably be documented in eightshift-docs.I should probably add a way to toggle this off. Do you prefer
WP_ENVIRONMENT_TYPE
, a special constant or both?After this change, it's no longer noticeable in the profile and the whole
registerServices
method now takes less time than just thebuildServiceClasses
method used to:I will open up additional PRs for optimization opportunities if I notice them.