Mercurial > public > mercurial-scm > hg
diff mercurial/changelog.py @ 35308:137a08d82232
transaction: build changes['revs'] as range instead of a set
Revisions are added consecutively, so a range can easily represent them
in the changes list. This saves around 45 Bytes / revision on 64bit
platforms and reduces the memory footprint of issue5691 by 15MB.
Don't copy changes['revs'] in getobsoleted. Ranges have a very efficient
contains implementation already.
Differential Revision: https://phab.mercurial-scm.org/D1615
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Fri, 08 Dec 2017 01:23:34 +0100 |
parents | 50474f0b3f1b |
children | 8810f0643fa1 |
line wrap: on
line diff
--- a/mercurial/changelog.py Wed Dec 06 16:43:07 2017 -0500 +++ b/mercurial/changelog.py Fri Dec 08 01:23:34 2017 +0100 @@ -541,5 +541,10 @@ *args, **kwargs) revs = transaction.changes.get('revs') if revs is not None: - revs.add(rev) + if revs: + assert revs[-1] + 1 == rev + revs = xrange(revs[0], rev + 1) + else: + revs = xrange(rev, rev + 1) + transaction.changes['revs'] = revs return node