@Fabianx spotted the file_exists() when we are registering namespaces in \Drupal\Core\Template\Loader\FilesystemLoader.
The file_exists() is not necessary here, just remove it. This would make all modules and themes available as Twig namespaces regardless of whether a 'templates' directory exists in the module/theme.
Beta phase evaluation
|Issue category||Task because it's a performance enhancement.|
|Issue priority||Major because we should not have any file_exists() calls during runtime.|
|Unfrozen changes||Unfrozen because it is a performance improvement in the theme system.|
User interface changes