[PATCH 0 of 4] spped up hg-add

Joshua Redstone joshua.redstone at fb.com
Fri Jun 22 15:49:45 CDT 2012


This patch series speeds up hg-add of a single file on a large repo from about
2.5 seconds down to 0.75 seconds.  It works by introducing a _sortedfiles
property into dirstate and some lazy caching into the case collision checker.

After the optimization, it looks like about 30% of time (say 0.3 seconds) is
spent copying dirstate._map and filtering out entries of type 'r'.  Sorting
the resulting list is negligable in time, as is the log-n searching the list
and even the o(n) insertion to update the list (probably because the constant
is so small?).

Time to add a single file drops from 2.5 -> 0.75 seconds on a large repo.
The time to add 10 files drops a similar amount, and is basically the same
as adding a single file.


More information about the Mercurial-devel mailing list