Can I optimize a Mercurial clone?

*爱你&永不变心* 提交于 2019-12-01 16:04:36

If the manifest gets particularly large then it can result in slow performance. Mercurial has an alternative repository format - generaldelta - that can often result in much smaller manifests.

You can check the size of your manifest using:

ls -lh .hg/store/*manifest*

To get maximum value from generaldelta:

  1. Install Mercurial 2.7.2 or later (2.7.2 includes a fix to a bug in generaldelta that could result in larger manifest sizes - but there's a good chance you won't hit the bug with an earlier version).

  2. Execute hg --config format.generaldelta=1 clone --pull orig orig.gd.

This may give some improvement in the manifest size, but not the full benefit.

  1. Execute hg --config format.generaldelta=1 clone --pull orig.gd orig.gd.gd.

The clone of the clone may give a much greater improvement in the manifest size. This is because when pulling from a generaldelta repo things will be reordered to optimise the manifest size.

As an example of the potential benefits of generaldelta, I recently converted a repo that was ~55000 SVN commits (pulled using hgsubversion) plus ~1000 Mercurial commits/merges/grafts, etc. The manifest in the original repo was ~1.4GB. The manifest in the first clone was ~600MB. The manifest in the clone of the clone was ~30MB.

There isn't a lot of information about generaldelta online - there's still work to be done before it can become the default format, but it works well for many projects. The first few Google search results have some information from when it was first introduced, and there was some recent discussion on the mercurial-dev mailing list.

I deleted the repo and recloned, and that improved performance.

Turn off real-time anti-virus monitoring of the folder the repo is cloned to and defrag. There's not much else you can do.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!