As follow-ups to #497118: Remove the registry (for functions), we should introduce back some modest memory and function call optimizations.
The elements are 2-fold:
- allow hook implementations to live in a single .inc file per module. This would be for info-type hooks like hook_menu() or hook_theme() that are only called rarely. E.g. modulename.hooks.inc
- Change functions like module_invoke_all() so that we cache a list of modules the implement certain hooks (and possibly whether the implementation is in the new .inc file). This would let us avoid doing a file_exists() + require_once for every hook invocation which the first element alone would need, plus make all such invocations more efficient.