diff rust/hg-core/src/lib.rs @ 41717:9060af281be7

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
author Georges Racinet <georges.racinet@octobus.net>
date Mon, 04 Feb 2019 19:46:57 +0100
parents ee7b7bd432a1
children 10b465d61556
line wrap: on
line diff
--- a/rust/hg-core/src/lib.rs	Tue Feb 05 10:28:32 2019 +0100
+++ b/rust/hg-core/src/lib.rs	Mon Feb 04 19:46:57 2019 +0100
@@ -13,6 +13,11 @@
 /// 4 bytes, and are liberally converted to ints, whence the i32
 pub type Revision = i32;
 
+
+/// Marker expressing the absence of a parent
+///
+/// Independently of the actual representation, `NULL_REVISION` is guaranteed
+/// to be smaller that all existing revisions.
 pub const NULL_REVISION: Revision = -1;
 
 /// Same as `mercurial.node.wdirrev`