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 JMenu::getItems() #8864
This is related to #8863. I looked into JMenu::getItems() to see if this could be optimized further. While this is a small optimization, it still means that the count operation only has to be run once instead of for each menu item. The number of attributes does not change during this method call, so we can move this to the beginning of the method instead of it being part of the for-loop.
Thanks @volandku for this one, too.
it would be performance loss in case of:
for ($i = 0; $i < count($attributes); $i++)
In existing code all fine, for me. As I remember the first part of the for() loop is not called each cycle.