rust: less set lookups in MissingAncestors
using the return values of HashSet::remove(), we can factor
pairs of `contains()/remove()` into a single `remove()`.
On a perfdiscovery run done on the PyPy repository, prepared
with contrib/discovery-helper.sh 50 100, I do get a modest improvement
with this (mean of medians of three runs is better by 2%)
Sample readings, before this change:
! wall 0.175609 comb 0.180000 user 0.180000 sys 0.000000 (median of 58)
With this change:
! wall 0.171662 comb 0.180000 user 0.170000 sys 0.010000 (median of 60)
Differential Revision: https://phab.mercurial-scm.org/D5943
# Extension to write out fake unsupported records into the merge state
#
#
from __future__ import absolute_import
from mercurial import (
merge,
registrar,
)
cmdtable = {}
command = registrar.command(cmdtable)
@command(b'fakemergerecord',
[(b'X', b'mandatory', None, b'add a fake mandatory record'),
(b'x', b'advisory', None, b'add a fake advisory record')], '')
def fakemergerecord(ui, repo, *pats, **opts):
with repo.wlock():
ms = merge.mergestate.read(repo)
records = ms._makerecords()
if opts.get('mandatory'):
records.append((b'X', b'mandatory record'))
if opts.get('advisory'):
records.append((b'x', b'advisory record'))
ms._writerecords(records)