-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Use chg if available, to speed up Send/Receive times on Linux #350
Comments
The chg binary isn't included in the Mercurial4Chorus build we do. However, the source that we use does have the chg source code in the |
I've built chg (for Linux only) in Mercurial4Chorus now, and tried it out. Running four Send/Receive integration tests in the Lexbox repo, running them with hg took 220 seconds (3:40), and running them with chg took 181 seconds (3:01). That shaved off about 40 seconds out of a total of 220 seconds, an 18% speedup. Not as much as the theoretical maximum, but of course there was time spent waiting for the network and so on in those four tests, this wasn't just a single Send/Receive. But this proves that the chg build works, so I'll go ahead and merge in the Mercurial4Chorus PR and start a Chorus PR to pull that version into Chorus. Then I'll run the Chorus unit tests and see what the speed difference is. |
Using chg also shaves about 13% off the time to do CrdtMerge. A CrdtMerge of the sena-3 project when it doesn't exist locally yet (meaning it requires a S/R clone, a CRDT sync, then a regular S/R) goes from 48.6 seconds with hg to 41.9 seconds with chg. Not the spectacular improvement I was hoping to get, because there's a lot going on besides Mercurial startup times, but still a nice solid gain. |
One reason why I'm not seeing the speedups I expected might be because chg isn't getting to keep an hg process around for long. I was checking the output of |
Well, the Chorus unit tests produced a much more spectacular result. Running only the tests that were runnable on Linux, I got the following: with hg: Test summary: total: 1010, failed: 0, succeeded: 966, skipped: 20, duration: 1833.6s with chg: Test summary: total: 1010, failed: 5, succeeded: 961, skipped: 20, duration: 820.1s That's more than twice as fast (820.1 is 45% of 1833.6) — but with 5 test failures. The 5 test failures all involved running ChorusMerge, and looked something like this:
It's not surprising that LongToShortConverter.GetShortPathName failed on Linux; there's a |
Interesting: that "unable to load kernel32.dll" failure just showed up in a test run that wasn't using So that might be an issue in existing code, completely unrelated to the |
decided to close this as we ended up using an environment variable instead |
Watching Send/Receive logs on Language Forge, it has become clear that a large part of the time it takes to do Send/Receive involves waiting for a Python process to start in order to run commands like
hg log -r0 --template "{node}"
. #258 was an attempt at speeding this up by skipping some of those log commands when the result is already known, but it had to be conservative about what is cached and so not everyhg log
call is cached even if it could be.A better way we could improve the speed of Send/Receives, at least on Linux, would be to use the
chg
binary instead ofhg
. This is an hg command-line tool written in C, that communicates with a Python Mercurial process that stays in RAM and doesn't have to spin up every time. On a recent test of a Send/Receive with no changes (of thesena-3
project), it took about 0.7 seconds each time to spin up a Python process, and that happened 36 times during the course of the S/R. 36 times at about 0.7 seconds each makes 25.2 seconds spent waiting for a Python process to spin up. The total Send/Receive time was 46.7 seconds, meaning 54% of the Send/Receive time was spent simply waiting for a new Python process to spin up, do a single operation, and exit. Switching to usechg
instead would therefore cut Send/Receive time in half.Unfortunately, there is no chg.exe binary available for Windows in the TortoiseHg distribution that we're using in Mercurial4Chorus, so we can't easily replicate this speedup for most of our installed users. But it will definitely speed things up for Language Forge, so I think it's worth doing.
The text was updated successfully, but these errors were encountered: