-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[10.x] Optimize Laravel Configuration Loading Process #49313
Conversation
- Enhance the loading bootstrap process by remove loading all files. - Improve memory usage and performance. - Improve and change loadConfigurationFiles method - Improve and change getConfigurationFiles method
…erformance - Added 'loadedFromCache' variable flag to track whether all configs are loaded from cache. - Added 'configPath' variable to store the path of config files. - added configPath param on construct method and add exception for check app config is loaded and set 'configPath' & 'loadedFromCache' properties. - Implement 'load' method for check and load config if not loaded when configs are not loaded from cache. - Implement 'getConfigurationFile' method for get file path and file key address to use on 'load' method. - Implement 'hasMany' method for checking the existence of multiple config keys. - Update 'get' & 'set' & 'getMany' and 'has' methods to load needed configs (if not loaded) before process.
After change bootstrap config on 'LoadConfiguration' class to don't load all configs, this command cache configs are needed and loaded on booting. for solving this problem: - Update 'getFreshConfiguration' method to load all config before getting all.
*/ | ||
public function __construct(array $items = []) | ||
public function __construct(array $items = [], string $configPath = 'test') |
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.
This is a breaking change and would require targeting Laravel 11 (master branch)
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.
This change is not considered a breaking change, and it could be integrated into Laravel 10 without causing fundamental issues. More substantial changes are feasible for Laravel 11 if needed.
Performance optimizations aren't merged without before / after benchmarks of real world applications. |
Sure, I'll work on providing before and after benchmarks for real-world applications to validate the performance optimizations. I'll get back to you with the results shortly. |
@taylorotwell please read pr updated description and if possible, please check the changes, even if we ignore the performance improvement altogether, these changes give more benefits and flexibility to Laravel. Of course, more optimizations can be done, but it requires more changes and more testing. Currently, my goal is to reduce the limitations of Laravel. |
Optimize Laravel Configuration Loading Process
Description:
Benefits:
Example Scenario:
Note: