joomla/joomla-cms — pull request #2789 by Hackwar (2014-01-14 19:21:28+00:00)
Title: Implementing caching for getRootId() to save queries

The method getRootId() is executed numerous times per page load, for example when editing an article around 20 times. At the same time, that method always returns the same value. By adding a static variable as cache, we save us all those duplicate queries and they are only run once per table.