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//. 'active' would be one such param.
To get the list of all defined tags, we use array_keys. To check if a specific tag is defined, we use isset instead of 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 at Special:Tags and make it possible to efficiently fetch patrollable tags for display in revisions.
Updated table after comments 1, 2, 3. 'The `active'` status is passed as a param and the (int) param for "importance" is replaced with a (bool) 'needcheck'.`needcheck`. Also added (string) `source` for name of the extension and (array) `refs` for passing additional params like abuse filter ids.
| //key (tag name)// | //value (array of params)// | //result//
| //key// (tag name) | //value// (array of params) | //result//`visualeditor` | array( 'source' => 'VisualEditor', 'active' => true, 'needcheck' => false ) | active, not patrollable, not listed at Special:ProblemChanges
| '| `visualeditor'-needcheck` | array( 'source' => 'VisualEditor', 'active' => true, 'needcheck' => true ) | active, 'needcheck' => false ) | activepatrollable, not patrollablelisted at Special:ProblemChanges
| 'visualeditor-needcheck'| `possible vandalism` | array( 'source' => 'VisualEditor''AbuseFilter', 'active' => true, 'needcheck' => true, 'refs' => array( 12, 45) ) | active, used by abuse filters 12 and 45, 'needcheck' => true ) | activepatrollable, patrollablelisted at Special:ProblemChanges
| 'possible vandalism' | array( 'source' => 'AbuseFilter', 'active' => true, 'needcheck' => true, 'refs' => array( 12, 45) ) | active, patrollable, used by abuse filters 12 and 45`OAuth CID : 457` | array( 'active' => false) | inactive
| 'OAuth CID : 457' | array( 'Params : (string)`source`, (bool)`active' => false) | inactive`, (bool)`needcheck`, (array)`refs`
The hooks ListDefinedTags and ListActiveTags should be deprecated eventually.