Page MenuHomePhabricator

Skip User edit count computation in Autopromote if APCOND_EDITCOUNT isn't used
Closed, ResolvedPublic

Description

Currently Autopromote performs an edit count lookup for user on each permissions check, even if no autopromote groups actually have an edit count condition (at https://github.com/wikimedia/mediawiki/blob/master/includes/Autopromote.php#L180). It may be worth considering skipping edit count lookup if edit count condition is 0 - it can spare quite a few queries with minimal effort, especially since edit count lookup may also trigger DB write.

On Wikia, implementing this logic for edit count lookup (https://github.com/Wikia/app/blob/dev/includes/Autopromote.php#L121) saves ~400k SQL queries per day. While Wikimedia's setup is notably different, this may nevertheless be some low-hanging performance fruit for a Wikipedia-sized project.

Event Timeline

Change 337807 had a related patch set uploaded (by TK-999):
In Autopromote skip edit count lookup if requirement is 0 or invalid

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

I've attached a patch which adds a simple check to return early if condition is 0 or invalid, with an associated unit test.

Krinkle renamed this task from In Autopromote consider skipping edit count lookup if APCOND_EDITCOUNT is 0 to Skip User edit count computation in Autopromote if APCOND_EDITCOUNT isn't used.May 21 2017, 2:31 PM
Krinkle closed this task as Resolved.
Krinkle assigned this task to TK-999.
Krinkle triaged this task as Medium priority.
Krinkle edited projects, added Performance Issue; removed Patch-For-Review.

Change 337807 merged by jenkins-bot:
[mediawiki/core@master] In Autopromote skip edit count lookup if requirement is 0 or invalid

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