-
Gregory Szorc authored
Previously, we emitted every Git tree when updating between Mercurial changesets. With this patch, we now only emit Git trees that changed. A side-effect of the implementation is that we now only update in-memory Git trees objects that changed. Before, we always touched Git trees, invalidating them in the process and causing Dulwich to recalculate their SHA-1. Profiling revealed this to be expensive and removing the extra calculation shows a nice performance win. Another optimization is to not sort the order that changed paths are processed in. Previously, we sorted by length, longest to shortest. Profiling revealed that the sorts took a non-trivial amount of time. While sorted execution resulted in likely idempotent behavior, it shouldn't be strictly required. On the author's machine, conversion of the Mercurial repository itself decreased from ~493s to ~333s. Even more impressive is conversion of Firefox's main repository (which is considerably larger). Converting the first 200 revisions of that repository decreased from ~152s to ~42s.
Gregory Szorc authoredPreviously, we emitted every Git tree when updating between Mercurial changesets. With this patch, we now only emit Git trees that changed. A side-effect of the implementation is that we now only update in-memory Git trees objects that changed. Before, we always touched Git trees, invalidating them in the process and causing Dulwich to recalculate their SHA-1. Profiling revealed this to be expensive and removing the extra calculation shows a nice performance win. Another optimization is to not sort the order that changed paths are processed in. Previously, we sorted by length, longest to shortest. Profiling revealed that the sorts took a non-trivial amount of time. While sorted execution resulted in likely idempotent behavior, it shouldn't be strictly required. On the author's machine, conversion of the Mercurial repository itself decreased from ~493s to ~333s. Even more impressive is conversion of Firefox's main repository (which is considerably larger). Converting the first 200 revisions of that repository decreased from ~152s to ~42s.
hg2git.py 11.09 KiB