Last modified: 2014-10-25 18:57:48 UTC
Currently, mw.title is implemented using Title. This results in unnecessary expensive calls in multiple situations, such as when validating a title (1 expensive call when none are necessary), and when checking whether a file exists (2 expensive calls when only 1 is necessary). For this reason, it should be modified to use the TitleValue class wherever possible.
Upon looking closer, it seems that this problem isn't caused by Title itself (and thus wouldn't be fixed simply switching to TitleValue), but by the way Scribunto grabs information about the title.
Unfortunately, the expensive work seems to be necessary. To properly purge pages that refer to the title if the page gets created or deleted, we need to record a link to it. And to record a link, we need to load the page_id. And loading the page_id for a title is the same thing that was rejected for being made not-expensive in Gerrit change #127160.
I wonder if it's possible to do lazy loading in Lua. Obvious it's not needed to load page_id if I want to extract the namespace of a title.
What Liangent is saying is basically what I was trying to say. If you just want to validate, canonicalize, etc., there's no reason to hit the DB at all.
Hmm. Depending on the properties actually used, we may not need to record the link. So maybe we *can* get away with this in some cases.