Menu

#606 Not load unnecessary data in token()

open
Legoktm
rewrite (37)
5
2013-04-08
2013-04-08
Anonymous
No

In token(), It queries info and *all* revisions of a page. Querying all revisions is too expensive and unnecessary. For example, if I just want to process the last revision of several pages and put them back, with the old code, it loads all revisions when putting. It makes putting in rewrite branch spend time about 10x compared to that in the trunk.

The patch I am presenting just do not load revisions. It shouldn't break other functions since needed data has included in the info of a page.

----
Pywikibot branches/rewrite/ (r11357, 2013/04/07, 14:50:30, ok)
Python 2.7.3 (default, Sep 26 2012, 21:53:58)
[GCC 4.7.2]
unicode test: ok

Discussion

  • Nobody/Anonymous

    patch

     
  • Nullzer0

    Nullzer0 - 2013-04-08

    I forgot to login again, sorry.

    Anyway, I think that token() should be rewrited. Its function should be restrict to just obtain the token. If we want lastrevid or other informations, it should place somewhere else. This will make token not bind to a page.

     
  • Legoktm

    Legoktm - 2013-04-08
    • assigned_to: nobody --> legoktm
     
  • Legoktm

    Legoktm - 2013-04-08

    Committed in r11359, thanks.

    I do agree that token() does need a re-think, it probably should be using a straight query rather than a generator, we also should be caching tokens per login session. Gonna leave this open for now so it can be properly fixed.

     

Log in to post a comment.