Each delegate requires an SQL query
A for , submitted by nickdunn on 05 January 2010
Announcement
Symphony's issue tracker has been moved to Github.
Issues are displayed here for reference only and cannot be created or edited.
Browse
Closed#196: Each delegate requires an SQL query
I’ve found an interested article about caching mechanism. Have a look.
Good spot. Although not generic, Symphony’s core uses a similar method in the FieldManager
and ExtensionManager
classes by pooling instantiated objects. I’m suggesting increasing the scope of this cache to include not only instantiated Extensions, but also the delegates to which they subscribe.
This issue is closed.
Hot on the heels of my changes to cut DS queries, the second biggest creator of queries is the
ExtensionManager::notifyMembers
method. For every delegate that fires during a page’s lifecycle, an SQL query is made to return any enabled extensions which subscribe to the specific delegate. For example:Because the
sym_extensions_delegates
table never gets above about 200 rows (when you have many extensions) these queries are lightning fast: 0.0003s on my local machine.This could be done using a single SELECT query and storing the entire table in memory:
The
ExtensionManager
would hold this as a multidimensional array in memory and thenotifyMembers
function would look up in this array rather than performing additional SQL queries.Fewer queries does not necessarily dictate a performance gain some testing would be required to assess the memory usage of both to ascertain which provides the most optimised experience.