You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While doing some profiling, I found that the t() function can be doing a config_get() call every single time it is called. With t() executed hundreds of times per page, this was resulting in a lot of disk accesses.
The problem is that we're checking config_get('locale.settings', 'translate_english') in t(), but the Locale module might not have been enabled in the first place. This results in locale.settings.json not existing, and the config_get() having to check for the file every request. We should optimize this by:
Moving translate_english into system.core.json so it always exists.
Statically caching the result of the $translate_english variable in t().
The text was updated successfully, but these errors were encountered:
This was a pretty grievous performance bug. XHProf before/after on the admin/content page:
I found that moving the translate_english option to system.core was unnecessary. We can just treat a NULL value as FALSE if Locale module is not enabled.
While doing some profiling, I found that the t() function can be doing a config_get() call every single time it is called. With t() executed hundreds of times per page, this was resulting in a lot of disk accesses.
The problem is that we're checking
config_get('locale.settings', 'translate_english')
in t(), but the Locale module might not have been enabled in the first place. This results in locale.settings.json not existing, and the config_get() having to check for the file every request. We should optimize this by:translate_english
into system.core.json so it always exists.The text was updated successfully, but these errors were encountered: