- 🇬🇧United Kingdom catch
This is amazingly still relevant, but won't be after 📌 Handle module preprocess functions Active so closing out. We can look at attribute parsing improvements or changing how the theme system works in general.
A theme registry rebuild currently looks like this:
- invoke hook_theme() for all modules + the base theme + current theme in use.
- if any of those theme definitions specifies include files, require_once() them.
- check function_exists() for process and preprocess functions.
The include files tend to be either quite large .theme/.theme.inc files (this a pattern contrib uses), or alternatively files like system.admin.inc or node.pages.inc that are huge.
The result, is that those files - which were originally designed to be only requested by the menu system for a specific callback, end up being loaded altogether in one go.
During profiling, I did not have a warm APC cache for all of these files, that's quite likely to be the case on real sites too - you don't browse 'round every admin page every time you restart apache (and not all files on the system will fit into apc necessarily, I know of a D6 site that needs 80mb for APC due to having a lot of contrib and custom modules).
Since APC isn't warm, you get an APC cache miss - which means these files take just as much memory as they would if it was disabled (and also you get some cache contention same with any other cache miss).
Having said all that, this isn't an easy problem to solve, some possibilities though:
1. file_get_contents() the file, use tokenizer or a regexp to find function matches - this is roughly what the registry does. It is likely to be less memory intensive than including the files, but may be slower (and definitely more complex).
2. Once #1011614: Theme registry can grow too large for MySQL max_allowed_packet and memcache default slab size → is in, it would be possible to skip the process and preprocess step when building the full registry, and fill in those gaps when theme hooks are actually requested - this way only the files actually in use for that request would be included, which happens anyway. This would start to look very similar to the module_implements() cache in that case.
Closed: outdated
11.0 🔥
theme system
It affects performance. It is often combined with the Needs profiling tag.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
This is amazingly still relevant, but won't be after 📌 Handle module preprocess functions Active so closing out. We can look at attribute parsing improvements or changing how the theme system works in general.