Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Optimizing JComponentHelper::getComponent #5124
Joomla currently loads each and every component seperately when it tries to retrieve the parameters of a component for example. On a vanilla Joomla, that means at least an additional 7 queries per pageload. This PR combines those into one query against the extension table and caching all results of that. This means less load for the database, less (albeit neglectable) memory consumption for Joomla and slightly less execution time for the overall system. The effects on a test-system might not be big, but it will be an optimization for larger systems.
This PR has one downside: So far the protected methode load() retrieved the data and then created the params object of each component. With the change I could either generate the params object for all components up front, or delegate that step to the getComponent() method and do it on demand. I choose the later option. This means that the load() method has a slightly changed behavior, which could be called a break in backwards compatibility. Since load() would only be accessible from inside the JComponentHelper class or a class inheriting from it and I simply can't think of a reason to create such an inheriting class, this change seems acceptable. However, I'd like to hear other opinions on this.