Since the ListActiveTags hook was implemented, I noticed a significant increase in loading time at Special:Tags. Extensions use this hook in addition to the ListDefinedTags hook. This means they must hit their database twice for many tags.
In order to implement T89553, we need a way for extensions to specify which tags should be 'patrollable', or for T91425, which tags are considered to indicate a 'problem'. If we used the same scheme, this means we would have to create yet another hook listing these.
This would only increase the performance issues, but in that case it would have a greater impact since the list of 'patrollable' tags must be fetched when displaying recent changes to users who can patrol (it would be cached, but still).
I think we should completely change the approach and instead use a single hook "ListDefinedTagsWithParams" that provides the tag names as //keys// and an array of params as //values//. A tag is considered active if its array of params is not empty.
To get the list of all defined tags, we apply array_keys. To get the list of all active tags, we apply array_filter then array_keys. To check if a specific tag is defined, we use isset, and to check if a specific tag is active, we cast the value of the tag to (bool). This is faster than using in_array. We would need to hit the database only once and could get all the relevant data in one go. Having these keys is also going to be faster when making lists, since array_intersect and array_diff are just as inefficient as in_array. I think this will significantly increase loading time and make it possible to efficiently fetch patrollable tags for display in revisions.
Updated table after comments 1, 2, 3 (uses 'active' subkey) :
| //key// (tag name) | //value// (array of params) | //result//
| 'visualeditor' | array( 'source' => 'VisualEditor', 'active' => true, 'patrollable' => false ) | active, not patrollable
| 'visualeditor-needcheck' | array( 'source' => 'VisualEditor', 'active' => true, 'patrollable' => true ) | active, patrollable
| 'possible vandalism' | array( 'source' => 'AbuseFilter', 'active' => true, 'patrollable' => true, 'refs' => array( 12, 45) ) | active, patrollable, used by abuse filters 12 and 45
| 'OAuth CID : 457' | array( 'active' => false) | inactive
The hooks ListDefinedTags and ListActiveTags should be deprecated eventually.