-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[6.0] Cache language files #45289
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
base: 6.0-dev
Are you sure you want to change the base?
[6.0] Cache language files #45289
Conversation
What about when an override is created? |
overrides are also ini files, the caching depends on the modification time of the ini file and will automatically create a new cache based on it. |
I have tested this item 🔴 unsuccessfully on 4a7a88c Enabled language debug This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45289. |
funny, because actually the error collector function is broken, can you please. can you please test 2 things (because I can't replicate it). first move this line out of the try block, so the exception is not cached and you can see it.
second add [] around the text string
then your error message shouldn't be warning anymore third be sure to use the latest version from the "Preserve directory structure" or later commit, since I fixed the that frontend languages are used in backend and vis-a-vis. |
I have no windows to test, but hope my change fixed it. |
That change worked. tested that overrides still work Not tested any performance changes |
I have tested this item ✅ successfully on 3acc14c This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45289. |
Reading and parsing a json file is faster. like json_decode(file_get_contents('administrator/cache/language/administrator-language-en-GB-lib_joomla.ini.1743321429.json'),true); about 30% on my stystem |
can you please show me you measurements, because my test says it's about 8-10 times slower using json for empty frontpage and using a 1mb ini files it's 80-100 times slower. |
Hi, I found the difference: php is a lot faster with opcache enabled. Without opache json. So the caching strategy should depend on the opcache setting to makeit fancy? tested on 52 language files on a (almost) clean j6 site. opache on: J: 2528880 opache off: J: 3127872 |
KISS, if you don't use opcache you don't care about performance so we shouldn't blow up our codebase for nothing. |
I have tested this item ✅ successfully on 3acc14c I can honestly say I saw consistently faster speeds however the speed improvement varied from quite a bit from 10% - 26% - I did the battery of test 5 times to get a sense but the large difference I assume comes from 1. the fact that caching is complex and 2. I have fast hosting so the speed difference would be small. Either way I trust you guys! :) This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45289. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45289. |
Just curious, why did you not use the Joomla cache API? |
because it's too slow, the caching api would save the content to a file or database or apcu or whatever, which means it needs to load it (over tcp as worse case) and then decode the string and transform it into an array. when doing it directly it uses the opcache in memory and in binary/compiled format. But for this to work you need a file on the filesystem. There is no faster format then opcache, normally I would say yes use the caching api from joomla but since it's a very specific case (it's saved in the "wrong" format ini) I have chosen this way. Above you see the variant with json which is slower, I would expect similar results for the joomla caching layer. |
Summary of Changes
Add a caching layer to the languageHelper::parseIniFile method.
Benchmark the function on within the system is not easy the the performance gain is in about 1,5 to 20ms depending on language size and server configuration.
My benchmark on this method only for the backend dashboard had the following results.
Without patch: 2,6-3.0ms
With patch cold cache: 7,6-11ms
With patch warm cache: 0.3-1.11ms
Means a performance gain of 130% to 900% per page load (for language loading).
Using a synthetic 1mb big ini file (35k lines) the following benchmarks apply:
Without patch: 14,6-25,2ms
With patch cold cache: 32,9-34,5ms
With patch warm cache: 0.5-0,9ms
Means a performance gain of 1500% to 5000% per page load (for language loading).
The Benchmark are taken on a Webserver with production load so might be
The results depend heavily on the server configuration and benefits if opcache is used (which is usually active since a couple of years on most(all) hosting providers).
The cache automatically invalidates it's self as soon as the ini file has a new modification timestamp.
Testing Instructions
Actual result BEFORE applying this Pull Request
Expected result AFTER applying this Pull Request
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed