Speeding up Mercurial

Just a reminder:  Mercurial repository clones get slower over time.  It’s worth deleting and recloning every so often.

For example, I had one old repository that I’d done a lot of work in and updated many times.  It had a patch queue containing a single patch. I tried doing hg qdiff four times in a row. The first one took 65 seconds, and the next three each took 16 seconds.

I deleted the repository, re-cloned, re-applied the patch, and hg qdiff now takes 1 second. Much better.

6 Responses to Speeding up Mercurial

  1. Do you also get the same performance improvement by locally cloning a repository? It should be faster to clone locally than having to download all the repository.

  2. Maybe something like “git gc” would help?

  3. Have you filed a bug? This is very weird.

  4. Related to old repository formats? ( http://www.selenic.com/mercurial/hgrc.5.html#format ) With which version of Mercurial was your old repository created with?

    Or disk fragmentation?

    • Nicholas Nethercote

      I’m using 1.9.1 and created the repo with that version, so that shouldn’t be relevant, judging from that link.

      I guess disk fragmentation is at least part of the story.