Page MenuHomePhabricator

[ENG] Investigate existing modules for possible performance optimizations
Open, Needs TriagePublic

Description

After T401288 is implemented, it might worth to investigate existing modules.

We want to maximise the effect of granular entity usage tracking by making sure modules are written in compliance with it. As it is mentioned in this comment written after X usage is implemented, we see module code could make a difference.

Similar to T381098 and can be merged for research.

E.g. look at modules in the wiki clients

Checklist:

  • Is it a common practice to access an entity aspect with a specific language? Or do they access all and iterate through them with a for loop to find the one they need?
  • Locally: if we access the whole object or whole entity aspect, do we get entity usage about the other usages as well (is it acting like a bundle when we read the whole object)
  • Is there a way for seeing which module affects which pages & vice versa?
  • Consider EU and RC are stored on different tables
  • Calculate baselines if possible to compare later
  • Is X usage really needed on RC table (since it dos not include aliases now). To find out: is it possible to be subscribed to X usage currently? How common is that? (maybe this needs to go to another ticket)
    • Is X usage still in the tables anyways? Verification needed.

Acceptance criteria:

  • possible follow up tickets

Details

Other Assignee
seanleong-WMDE

Event Timeline

This ticket can increase priority after we recognized that we need more reduce in DB. Here are latests brainstorm:

Possibly suspicious Lua code

seanleong-WMDE renamed this task from Investigate existing modules for possible performance optimizations to [ENG] Investigate existing modules for possible performance optimizations.Feb 10 2026, 3:57 PM

Investigation summary:

Category only changes that read from wikidata
We noticed https://tr.wikipedia.org/wiki/%C5%9Eablon:Kitap_bilgi_kutusu was tagged as using p18 image even though the wikipedia page doesn't include an image. This lead us to find the category No_local_image_but_image_on_Wikidata which checks Wikidata in order to assign a category, rather than to actually use the image.
This example also has no image, but uses p18 - https://en.wikipedia.org/w/index.php?title=Benson_Jack_Anthony&action=info

This lead to the hard/soft usage idea https://phabricator.wikimedia.org/T416822 , which could apply to category-only changes. However, use of a specific method for ‘soft (suppressed)’ usages would have to be done by the lua coders manually and is error prone (read more details on the ticket comments)

Actual no-op reads of wikidata
We also found modules which look up a wikidata item but then this does not affect the page or category. We worked on improving these modules and saw a decrease in unnecessary usage of P18 - see our communication with the community on this and the ticket

Frequent ‘subclass’ usages in French wikipedia
In the French Wikidata module, subclass is used by these two:
Excludes superclasses: looks like not used in many modules
https://fr.wikipedia.org/w/index.php?search=insource%3A%22excludesuperclasses%22+prefix%3AModule%3A&title=Sp%C3%A9cial%3ARecherche&profile=advanced&fulltext=1&ns0=1
Target superclass use in modules:
https://fr.wikipedia.org/w/index.php?search=insource%3A%22targetsuperclass%22+prefix%3AModule%3A&title=Sp%C3%A9cial%3ARecherche&profile=advanced&fulltext=1&ns0=1 E.g. https://fr.wikipedia.org/wiki/Module:Infobox/Fonctions/Personne p.specialrole() - used by “Notable Status” which checks the subclasses

Inside the timeline method, we have local statements = wikidata.wikidata.getClaims(wdconf) that goes here https://fr.wikipedia.org/wiki/Module:Wikidata
Inside getClaims we use filterClaims. excludesuperclasses is used in that.

In conclusion, investigations of this so far indicate that there is not a problem.

Working document with the examples we investigated
https://docs.google.com/document/d/1kmw4kRJPpOPAy4zYg6p5TjVOU4yJmMtqXqFFZbAPkio/edit?tab=t.uwsag4suqczx

Further research:
More investigation could be done here but for now we are focusing on different areas so we will mark this ticket as done.