Malafaya has uploaded a new change for review. https://gerrit.wikimedia.org/r/237445
Change subject: interwiki.py: check for category before emptiness ...................................................................... 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 --- M scripts/interwiki.py 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/45/237445/1 diff --git a/scripts/interwiki.py b/scripts/interwiki.py index 950f8f1..1ace2bc 100755 --- a/scripts/interwiki.py +++ b/scripts/interwiki.py @@ -1362,7 +1362,7 @@ # must be behind the page.isRedirectPage() part # otherwise a redirect error would be raised - elif page.isEmpty() and not page.isCategory(): + elif not page.isCategory() and page.isEmpty(): globalvar.remove.append(unicode(page)) if not globalvar.quiet: pywikibot.output(u"NOTE: %s is empty. Skipping." % page) @@ -1453,7 +1453,7 @@ 'Try again with -restore.') sys.exit() iw = () - elif page.isEmpty() and not page.isCategory(): + elif not page.isCategory() and page.isEmpty(): globalvar.remove.append(unicode(page)) if not globalvar.quiet: pywikibot.output(u"NOTE: %s is empty; ignoring it and its interwiki links" -- To view, visit https://gerrit.wikimedia.org/r/237445 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I00375411ca15658c22ae6bdb49588ec9f03b8c69 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Malafaya <malaf...@clix.pt> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits