-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated the HG prompt #2002
Updated the HG prompt #2002
Conversation
…ys have the branch name available.
Thanks! |
Just to throw this in here (cc @Stanzilla)
That's a total of 0.053 seconds, as opposed to
|
=/ @b0bh00d |
On 1/18/2019 4:50 AM, Martin Böhm wrote:
Just to throw this in here (cc @Stanzilla <https://github.com/Stanzilla>)
|hg id -ib|takes /significantly/longer than |hg branch|and |hg status|combined.
|D:\some\repo default λ hg branch --time default time: real 0.016 secs (user
0.016+0.000 sys 0.000+0.000) D:\some\repo default λ hg status --time M
test.txt time: real 0.037 secs (user 0.016+0.000 sys 0.016+0.000) |
That's a total of 0.053 seconds, as opposed to
|D:\some\repo default λ hg id -ib --time 6242b58ed6c7+ default time: real
0.251 secs (user 0.156+0.000 sys 0.094+0.000)|
|I ran the above commands using Mercurial version 4.7+11 on |||a "pristine"
working copy with a 7.1GB disc footprint and more than 27,000 managed files.
|Here's the result with some randomly modified files (and this is on an M.2
drive):
|
|λ hg branch --time|
|default.bob.lwk|
|time: real 0.005 secs (user 0.000+0.000 sys 0.000+0.000)|
||
|λ hg status -q --time|
|M Bootstrap.bat|
|M LightWave\layout\layo.cpp|
|M LightWave\layout\main.cpp|
|M Purge.bat|
||
|time: real 0.415 secs (user 0.344+0.000 sys 0.062+0.000)|
||
|λ hg id -ib --time|
|d61a2d50bfd4+ default.bob.lwk|
|time: real 0.553 secs (user 0.438+0.000 sys 0.125+0.000)|
||
|I'd guess my repo is considerably larger than yours, which accounts for the
much larger overhead of time on "hg status."
Without any modified or unmanaged files in the repo, the "quiet" version of
"hg status" takes much less time on my system:
|
|λ hg status -q --time|
||
|time: real 0.242 secs (user 0.125+0.000 sys 0.109+0.000)|
||
|However, if I remove the "quite" option, the time surprisingly skyrockets on
a "pristine" working copy:
|
|λ hg status --time|
||
|time: real 0.586 secs (user 0.531+0.000 sys 0.047+0.000)|
||
|"hg id" does indeed take more time, but I only have a difference of 0.133
between them using your commands. Additionally, the Lua code is only running
one command instead of two, which would I suppose double the execution
overhead, if we're counting milliseconds. It probably wouldn't add much, but
it would certainly reduce the difference by some amount.
|||||
|hg id -ib| works, i.e. it gets the needed information, but it's awfully
annoying to wait a 250ms-ish for every prompt. Maybe this isn't such a good
way forward after all.
|I'd love to have the speed of git, but Mercurial simply doesn't have it. If
100-200 milliseconds really means that much, then it can certainly be switched
to use the branch/status command pair instead. Just tell me if that's what
you want.
|
|
Okay, let's do some science. On my machine there currently are a total of 68 Mercurial repos of varying size and complexity, some small, some large, with subrepos and without, some clean, some with a couple of dirty files, some with a number of "unknown" files, too. (None of them has the order of 27,000 files, though I also believe that's not a typical use case.) Since So I ran Green on top is Its obvious that Overall, the timings of
(FWIW, for this test I've used Mercurial version 4.3.1, 64bit, on an SSD.) |
Per our email discussion, I have updated the HG prompt code to use the '-ib' option to 'hg id' so the branch name is always available, regardless of the state of the working copy.