Page MenuHomePhabricator

mw.title should avoid unnecessary expensive work
Closed, ResolvedPublic

Description

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.


Version: unspecified
Severity: enhancement

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:25 AM
bzimport set Reference to bz66328.
bzimport added a subscriber: Unknown Object (MLST).

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.

Change 178698 had a related patch set uploaded (by Jackmcbarn):
Avoid unnecessary database queries

https://gerrit.wikimedia.org/r/178698

Patch-For-Review

Change 178698 merged by jenkins-bot:
Avoid unnecessary database queries

https://gerrit.wikimedia.org/r/178698

Jackmcbarn claimed this task.