HomePhabricator

rust: itering less on MissingAncestors.bases for max()

Authored by gracinet.

Description

rust: itering less on MissingAncestors.bases for max()

Instead of iterating on the whole self.bases each time to find
its max, we keep the latter in a separate member attribute and
keep it up to date in add_bases()

On a perfdiscovery done on PyPy, with repos prepared with
contrib/discovery-helper.sh 50 100, this gives a slight
improvement (around 0.5% on wall time, but 10% on CPU)

before:
! wall 0.172801 comb 0.180000 user 0.180000 sys 0.000000 (median of 541)
after:
! wall 0.171798 comb 0.160000 user 0.160000 sys 0.000000 (median of 551)

(perf command run time upped because of bigger variability during this test).

Differential Revision: https://phab.mercurial-scm.org/D5945

Details