我可以优化 Mercurial 克隆吗?
我的 Mercurial 克隆变得非常慢,可能是由于磁盘碎片所致。有没有办法优化它?
最明显的方法是创建一个新克隆,然后将我的 MQ、保存的捆绑包、hgrc 等复制到新克隆并删除旧克隆。但似乎有人以前遇到过这个问题并进行了扩展来做到这一点?
My Mercurial clone has become incredibly slow, presumably due to on-disk fragmentation. Is there a way to optimize it?
The obvious way it to make a new clone, then copy my MQ, saved bundles, hgrc, etc, to the new clone and delete the old one. But it seems like someone might have run into this problem before and made an extension to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果清单变得特别大,则可能会导致性能下降。 Mercurial 有另一种存储库格式 - GeneralDelta - 通常会导致清单小得多。
您可以使用以下命令检查清单的大小:
ls -lh .hg/store/*manifest*
要从 GeneralDelta 获取最大值:
安装 Mercurial 2.7.2 或更高版本(2.7.2 包括修复了 GeneralDelta 中的一个错误,该错误可能会导致清单大小变大 - 但使用早期版本很可能不会遇到该错误)。
执行
hg --config format.generaldelta=1 clone --pull orig orig.gd
。这可能会在清单大小方面带来一些改进,但并不能带来全部好处。
hg --config format.generaldelta=1 clone --pull orig.gd orig.gd.gd
。克隆的克隆可能会在清单大小方面带来更大的改进。这是因为当从 GeneralDelta 存储库中提取内容时,将会重新排序以优化清单大小。
作为 GeneralDelta 潜在优势的一个例子,我最近转换了一个约 55000 个 SVN 提交(使用 hgsubversion 拉取)加上约 1000 个 Mercurial 提交/合并/移植等的存储库。原始存储库中的清单约为 1.4GB。第一个克隆中的清单约为 600MB。克隆的克隆中的清单约为 30MB。
网上关于 GeneralDelta 的信息并不多——在它成为默认格式之前还有很多工作要做,但它对于许多项目来说效果很好。前几个 Google 搜索结果包含了它首次引入时的一些信息,并且 Mercurial-dev 邮件列表上有一些最近的讨论。
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:
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).
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.
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.