[Python-apps-team] Bug#588611: mercurial: Performance hit on demandimport

Isaac Jurado diptongo at gmail.com
Sat Jul 10 08:44:15 UTC 2010


Package: mercurial
Version: 1.6-2
Severity: normal


Packaged mercurial performs worse than upstream mercurial (1.6).  After a quick
test (hg --profile branch, on the Mercurial repo itself) were the following,
from upstream:

   CallCount    Recursive    Total(ms)   Inline(ms) module:lineno(function)
           6            3      0.0011      0.0007   <__import__>
          +1            0      0.0004      0.0001   +mercurial.dirstate:8(<module>)
           1            0      0.0004      0.0001   mercurial.dirstate:8(<module>)
         +11            0      0.0002      0.0001   +mercurial.demandimport:81(_demandimport)
          +1            0      0.0001      0.0000   +mercurial.dirstate:37(dirstate)
          +1            0      0.0000      0.0000   +mercurial.demandimport:72(__getattribute__)
          20           17      0.0013      0.0001   mercurial.demandimport:72(__getattribute__)
          +4            1      0.0012      0.0001   +mercurial.demandimport:44(_load)
          +8            0      0.0000      0.0000   +mercurial.demandimport:72(__getattribute__)
          +4            0      0.0000      0.0000   +<getattr>
           4            1      0.0012      0.0001   mercurial.demandimport:44(_load)
          +4            1      0.0011      0.0007   +<__import__>
          +8            0      0.0000      0.0000   +mercurial.demandimport:72(__getattribute__)
          +4            0      0.0000      0.0000   +<method 'get' of 'dict' objects>
          11            0      0.0002      0.0001   mercurial.demandimport:81(_demandimport)
          +9            0      0.0001      0.0001   +mercurial.demandimport:32(__init__)
          +2            0      0.0000      0.0000   +<__import__>
          +2            0      0.0000      0.0000   +<method 'split' of 'str' objects>
          +2            0      0.0000      0.0000   +<hasattr>
           9            0      0.0001      0.0001   mercurial.demandimport:32(__init__)
           1            0      0.0001      0.0001   mercurial.util:504(__call__)
          +1            0      0.0000      0.0000   +mercurial.util:725(splitpath)
          +1            0      0.0000      0.0000   +<method 'update' of 'set' objects>
          +1            0      0.0000      0.0000   +<method 'pop' of 'list' objects>
          +2            0      0.0000      0.0000   +<method 'lower' of 'str' objects>
          +1            0      0.0000      0.0000   +<method 'add' of 'set' objects>
           1            0      0.0001      0.0001   <method 'write' of 'file' objects>
           1            0      0.0001      0.0000   mercurial.dirstate:37(dirstate)
         +11            0      0.0000      0.0000   +mercurial.util:159(__init__)
           1            0      0.0017      0.0000   mercurial.commands:454(branch)
          +1            0      0.0000      0.0000   +mercurial.encoding:31(tolocal)
          +1            0      0.0013      0.0000   +mercurial.util:162(__get__)
          +1            0      0.0001      0.0000   +mercurial.extensions:159(wrap)
          +1            0      0.0002      0.0000   +mercurial.dirstate:202(branch)
          +1            0      0.0000      0.0000   +<method 'get' of 'dict' objects>

And from the Debian packaged version (1.6-2):

   CallCount    Recursive    Total(ms)   Inline(ms) module:lineno(function)
           6            3      0.0182      0.0176   <__import__>
          +1            0      0.0006      0.0002   +mercurial.dirstate:8(<module>)
           1            0      0.0006      0.0002   mercurial.dirstate:8(<module>)
         +11            0      0.0002      0.0001   +mercurial.demandimport:81(_demandimport)
          +1            0      0.0001      0.0001   +mercurial.dirstate:37(dirstate)
          +1            0      0.0001      0.0000   +mercurial.demandimport:72(__getattribute__)
          20           17      0.0183      0.0001   mercurial.demandimport:72(__getattribute__)
          +4            1      0.0182      0.0001   +mercurial.demandimport:44(_load)
          +8            0      0.0000      0.0000   +mercurial.demandimport:72(__getattribute__)
          +4            0      0.0000      0.0000   +<getattr>
          11            0      0.0002      0.0001   mercurial.demandimport:81(_demandimport)
          +9            0      0.0001      0.0001   +mercurial.demandimport:32(__init__)
          +2            0      0.0000      0.0000   +<__import__>
          +2            0      0.0000      0.0000   +<method 'split' of 'str' objects>
          +2            0      0.0000      0.0000   +<hasattr>
           4            1      0.0182      0.0001   mercurial.demandimport:44(_load)
          +4            1      0.0182      0.0176   +<__import__>
          +8            0      0.0000      0.0000   +mercurial.demandimport:72(__getattribute__)
          +4            0      0.0000      0.0000   +<method 'get' of 'dict' objects>
           1            0      0.0001      0.0001   mercurial.dirstate:37(dirstate)
         +11            0      0.0000      0.0000   +mercurial.util:159(__init__)
           1            0      0.0001      0.0001   <method 'write' of 'file' objects>
           9            0      0.0001      0.0001   mercurial.demandimport:32(__init__)
           1            0      0.0001      0.0001   <method 'read' of 'file' objects>
           1            0      0.0001      0.0001   mercurial.util:504(__call__)
          +1            0      0.0000      0.0000   +mercurial.util:725(splitpath)
          +1            0      0.0000      0.0000   +<method 'update' of 'set' objects>
          +2            0      0.0000      0.0000   +<method 'lower' of 'str' objects>
          +1            0      0.0000      0.0000   +<method 'pop' of 'list' objects>
          +1            0      0.0000      0.0000   +<method 'add' of 'set' objects>

Ignoring the fact that the Debian version has fewer lines, it should be noted
the difference between the <__import__> line, (0.0011ms vs 0.0182, in both cases
is the third run, so it's supposed to be cached).

The upstream version was tested compiling with make local using python2.6-dev
from Debian.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.34.1
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mercurial depends on:
ii  libc6                         2.11.2-2   Embedded GNU C Library: Shared lib
ii  mercurial-common              1.6-2      scalable distributed version contr
ii  python                        2.6.5-5    An interactive high-level object-o
ii  python-support                1.0.9      automated rebuilding support for P
ii  ucf                           3.0025     Update Configuration File: preserv

mercurial recommends no packages.

Versions of packages mercurial suggests:
pn  qct       <none>                         (no description available)
ii  tk8.5 [wi 8.5.8-1                        Tk toolkit for Tcl and X11, v8.5 -
ii  tkdiff    1:4.1.4-1                      graphical side by side "diff" util
ii  vim       2:7.2.438+hg~d44112feb815-5+b1 Vi IMproved - enhanced vi editor
ii  vim-gtk [ 2:7.2.438+hg~d44112feb815-5+b1 Vi IMproved - enhanced vi editor -

-- no debconf information





More information about the Python-apps-team mailing list