Skip to content
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

Merged
merged 1 commit into from
Jan 5, 2019
Merged

Updated the HG prompt #2002

merged 1 commit into from
Jan 5, 2019

Conversation

b0bh00d
Copy link
Contributor

@b0bh00d b0bh00d commented Jan 1, 2019

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.

@Stanzilla Stanzilla merged commit 961f38a into cmderdev:master Jan 5, 2019
@Stanzilla
Copy link
Member

Thanks!

@Tomalak
Copy link
Contributor

Tomalak commented Jan 18, 2019

Just to throw this in here (cc @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)

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.

@Stanzilla
Copy link
Member

=/ @b0bh00d

@b0bh00d
Copy link
Contributor Author

b0bh00d commented Jan 19, 2019 via email

@Tomalak
Copy link
Contributor

Tomalak commented Jan 19, 2019

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 hg id -ib does not show the state of "unknown" files, I'm using hg status -amrd (added, modified, removed, deleted) in order to produce comparable output and keep the file listing short, because this takes time, too.

So I ran hg branch --time, hg status -amrd --time and hg id --time against all of these repositories and graphed the reported "real" time values in Excel as a stacked bar chart:

image

Green on top is hg id -ib, red below that is hg branch, blue at the bottom is hg status -amrd.

Its obvious that hg id -ib produces some huge outliers, whereas the performance of hg branch is pretty much constant through the board, and hg status is pretty low as well, but with some variance in the repos where there are modified files to report.

Overall, the timings of hg branch and hg status combined generally lie beneath the 50 millisecond threshold, which I would consider perfectly tolerable. My example above was taken from one of the repos that are an outlier for hg id -ib, that wasn't intentional though.

hg id -ib generally lies below or at the 50 ms threshold as well, but its performance is not as consistent. Also, committing any changes will bring hg status back to ~16ms, so the user has some control over it. On the other hand, hg id -ib seems to take its sweet time for complex repos no matter what state they are in.

(FWIW, for this test I've used Mercurial version 4.3.1, 64bit, on an SSD.)

@blghns blghns mentioned this pull request Feb 20, 2019
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants