Enabling the bzpost hg extension adds 2s to every hg command

RESOLVED WORKSFORME

Status

Developer Services
Mercurial: bzpost
RESOLVED WORKSFORME
2 years ago
2 years ago

People

(Reporter: jimb, Unassigned)

Tracking

Details

Attachments

(1 attachment)

(Reporter)

Description

2 years ago
Disabling the bzpost Mercurial extension removes around two seconds from every invocation of hg:

$ grep bzpost .hgrc
bzpost = /home/jimb/.mozbuild/version-control-tools/hgext/bzpost
$ time hg version
Mercurial Distributed SCM (version 3.5.2+5-d3712209921d+20151018)
(see http://mercurial.selenic.com for more information)

Copyright (C) 2005-2015 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

real	0m2.122s
user	0m2.041s
sys	0m0.084s
$ sed -i -e 's/^bzpost/#bzpost/' .hgrc
$ time hg version
Mercurial Distributed SCM (version 3.5.2+5-d3712209921d+20151018)
(see http://mercurial.selenic.com for more information)

Copyright (C) 2005-2015 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

real	0m0.224s
user	0m0.196s
sys	0m0.029s
$
I'm really just a bystander here, but why use bzpost now that pulsebot is commenting in bugs? The two reasons I'm aware of are (1) bzpost puts the first line of the changeset description into the comments, and (2) bzpost comments for try pushes too.

(1) came up last week, so I sent a pull request to glandium that adds the extra info into pulsebot comments. For (2), I personally don't like all of my embarrassing try pushes to clutter the bug (especially when I end up debugging via try, which can involve dozens of pushes). I would much rather have a system that was aware of the try pushes I've done, but waited for me to "accept" a try push before commenting with it. Then again, that wouldn't offer a whole lot over the status quo, where I can accept a try push by cutting & pasting its url into the bug.

Admittedly, that's enough of a wart on the rest of my workflow that I'm generally too lazy to actually do it, which argues that for me at least it is worth some automation. But mind the opportunity cost! :-)

Comment 2

2 years ago
Please attach `hg --profile version` output.
Flags: needinfo?(jimb)

Updated

2 years ago
Component: Build Config → Mercurial: bzpost
Product: Core → Developer Services
(Reporter)

Comment 3

2 years ago
sergei:~$ hg --profile version
Mercurial Distributed SCM (version 3.5.2+5-d3712209921d+20151018)
(see http://mercurial.selenic.com for more information)

Copyright (C) 2005-2015 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   CallCount    Recursive     Total(s)    Inline(s) module:lineno(function)
           2            0      0.0001      0.0001   <__import__>
           2            0      0.0001      0.0001   <method 'write' of 'file' objects>
           3            0      0.0001      0.0001   mercurial.i18n:46(gettext)
           1            0      0.0005      0.0000   mercurial.commands:6531(version_)
           2            0      0.0002      0.0000   hgext.color:433(write)
           5            0      0.0000      0.0000   <method 'decode' of 'str' objects>
           5            4      0.0000      0.0000   mercurial.demandimport:111(__getattribute__)
           2            0      0.0001      0.0000   mercurial.ui:571(write)
           2            0      0.0000      0.0000   hgext.color:470(label)
           1            0      0.0000      0.0000   mercurial.demandimport:83(_load)
           1            0      0.0005      0.0000   mercurial.dispatch:892(<lambda>)
           3            0      0.0000      0.0000   <method 'encode' of 'unicode' objects>
           5            0      0.0000      0.0000   <method 'split' of 'str' objects>
           1            0      0.0001      0.0000   mercurial.ui:780(status)
           4            0      0.0000      0.0000   gettext:219(ugettext)
           3            0      0.0000      0.0000   <method 'join' of 'unicode' objects>
           1            0      0.0005      0.0000   mercurial.util:790(check)
           2            0      0.0000      0.0000   mercurial.ui:900(_progclear)
           2            0      0.0000      0.0000   <vars>
           1            0      0.0001      0.0000   mercurial.util:356(version)
           1            0      0.0000      0.0000   hgext.color:396(valideffect)
           5            0      0.0000      0.0000   <method 'get' of 'dict' objects>
           2            0      0.0001      0.0000   mercurial.demandimport:53(_hgextimport)
           1            0      0.0001      0.0000   mercurial.demandimport:120(_demandimport)
           1            0      0.0000      0.0000   mercurial.__version__:2(<module>)
           1            0      0.0005      0.0000   mercurial.dispatch:980(checkargs)
           2            0      0.0000      0.0000   <method 'join' of 'str' objects>
           1            0      0.0000      0.0000   six:180(find_module)
           1            0      0.0000      0.0000   mercurial.ui:795(note)
           1            0      0.0000      0.0000   <getattr>
sergei:~$
Flags: needinfo?(jimb)

Comment 4

2 years ago
Uhhh, I don't see a 2s pause.

Try `python -mcProfile -scumtime /path/to/hg --time --version`.
Flags: needinfo?(jimb)
(Reporter)

Comment 5

2 years ago
Created attachment 8676414 [details]
Output from: python -mcProfile -scumtime /home/jimb/mercurial/hg-stable/hg --time --version

Today I can only reproduce a 0.9s slowdown by enabling the bzpost extension. I did erase all the .pyc files from ~/.mozbuild/version-control-tools yestday; I can't think of anything else that could account for the change.
Flags: needinfo?(jimb)

Comment 6

2 years ago
This is https://github.com/pyca/pyopenssl/issues/137.

Somewhere you have pyopenssl and cryptography Python packages in sys.path. requests (used by Bugsy which is used by bzpost and a number of other extensions in version-control-tools) will attempt to import pyopenssl, which will incur a slowdown.

Upgrading pyopenssl and cryptography packages (`pip install --upgrade pyopenssl cryptography` assuming you used pip to install them before) should hopefully make the problem go away.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.