HomePhabricator

interwiki.py: check for category before emptiness

Authored by Malafaya.

Description

interwiki.py: check for category before emptiness

Currently, page.isEmpty() requires parsing the whole page and doing some
removals (langlinks and categories) which takes up significant CPU time.
There are 2 checks which use page.isEmpty() as the starting condition
while having a much simpler second condition of just checking the page
namespace.
In this patch, I reversed the checks order. For categories, the time
taken in batchLoaded() is reduced to about 30% of the original time.

Change-Id: I00375411ca15658c22ae6bdb49588ec9f03b8c69

Details

Committed
MalafayaSep 10 2015, 6:09 PM
Parents
rPWBC67b2cca00956: timestamp_tests.py: replace Timestamp.toISOformat
Branches
Unknown
Tags
Unknown
ChangeId
I00375411ca15658c22ae6bdb49588ec9f03b8c69