D8110: rust-dirstatemap: cache non normal and other parent set

kevincox (Kevin Cox) phabricator at mercurial-scm.org
Thu Feb 13 13:15:15 UTC 2020


kevincox added inline comments.

INLINE COMMENTS

> dirstate_map.rs:38
> +    non_normal_set: Option<HashSet<HgPathBuf>>,
> +    other_parent_set: Option<HashSet<HgPathBuf>>,
>      parents: Option<DirstateParents>,

I don't understand why an `Option<HashSet>` is faster than a `HashSet`. Could you add some explanation to the commit message? Is this to avoid attempting to initialize the entry multiple times?

> dirstate_map.rs:251
> +        self.set_non_normal_other_parent_entries(false);
> +        (&mut self.non_normal_set, &mut self.other_parent_set)
> +    }

If we have just set the fields to Some(..) in the previous line can't we do the unwrap here where it is obviously correct?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8110/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8110

To: marmoute, #hg-reviewers
Cc: kevincox, mercurial-devel


More information about the Mercurial-devel mailing list