-
-
Notifications
You must be signed in to change notification settings - Fork 979
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
Improvement: Remove Cached JSON File Reading for Faster Performance #1876
Conversation
Regarding the issue #1745, completely eradicating the caching system is not advisable. The ability to disable or enable it when needed is sufficient. By default, it is disabled, which effectively makes it inactive, but it allows those who find it useful to activate it when necessary. I recommend testing other scenarios, such as those mentioned in #1745 (comment), #1745 (comment), #1745 (comment), #1745 (comment), for potential improvements. When proposing a change or feature like this, consider its impact on others. The best practice is to provide a configuration option to enable or disable the feature as needed, and this element meets that requirement. Thank you for your contribution. |
Did you review the changes and test this pull request? This pull request only deletes the cache of the JSON file of the modules (NOT ALL CACHE) and does not address the mentioned issue. |
Yes, sir. I did.
You asked that the "The ability to disable or enable it when needed is sufficient. By default, it is disabled, which effectively makes it inactive, but it allows those who find it useful to activate it when necessary." |
Please follow the "How to Test This" section in the description and share your results. The default cache driver is |
Does this happen even when |
Your test ignored the condition "... By default, it is disabled, which effectively makes it inactive, but it allows those who find it useful to activate it when necessary." |
@alissn Reading from file is constantly faster, I ran 150 modules and ran the benchmarks. I don't see any obvious downside to this PR, this alone won't solve the speed issue when there's 150+ modules. Disabled modules won't be loaded, this only effects active modules as you already mentioned.
|
Hi, This pull request aims to improve the speed of module loading by reading files directly from the modules. It's part of a series of pull requests focused on enhancing performance. In subsequent pull requests, I'll address other sections to further speed up loading. Thanks. |
Hi,
In this pull request, I propose removing the cached JSON file reading and instead reading directly from the file. This approach is significantly faster (~12x on my OS).
How to Test This
Create a new fresh Laravel project and generate 150 modules. Use the following console command:
Run this command in the terminal:
Publish the module config file and set
cache.enabled
to true or set the environment variableMODULES_CACHE_ENABLED=true
.Create a benchmark route with this code:
Benchmark Results
Here are my results on

redis
cache is:on
file
driver and, first run :after 3 4 run, result improve: