# HG changeset patch # User Matt Mackall # Date 1447382921 21600 # Node ID 3309714ded262f1bb3e32dd552b01d6926de06d5 # Parent ef5bab63af85b74914c3e8ea59cf8abf73a8571c# Parent 8a256cee72c890c761918ec1d244b286694ac51b merge with stable diff -r ef5bab63af85 -r 3309714ded26 mercurial/tags.py --- a/mercurial/tags.py Tue Nov 10 15:08:56 2015 -0800 +++ b/mercurial/tags.py Thu Nov 12 20:48:41 2015 -0600 @@ -221,9 +221,13 @@ ''' filetags, nodelines = _readtaghist(ui, repo, lines, fn, recode=recode, calcnodelines=calcnodelines) + # util.sortdict().__setitem__ is much slower at replacing then inserting + # new entries. The difference can matter if there are thousands of tags. + # Create a new sortdict to avoid the performance penalty. + newtags = util.sortdict() for tag, taghist in filetags.items(): - filetags[tag] = (taghist[-1], taghist[:-1]) - return filetags + newtags[tag] = (taghist[-1], taghist[:-1]) + return newtags def _updatetags(filetags, tagtype, alltags, tagtypes): '''Incorporate the tag info read from one file into the two