This is an archive of the discontinued Mercurial Phabricator instance.

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

Authored by Alphare on Jan 30 2020, 9:09 AM.

Details

Summary

Performance of hg update was significantly worse since the introduction of
the Rust dirstatemap. This regression was noticed by Valentin Gatien-Baron
when working on a large repository, as it goes unnoticed for smaller
repositories like Mercurial itself.

This fix introduces the same getter/setter mechanism at hg-core level as
for set/get_dirs.

While this technique is, as previously discussed, quite suboptimal, it fixes an
important enough problem. Refactoring hg-core to use the typestate
pattern could be a good approach to improving code quality in a future patch.

Diff Detail

Repository
rHG Mercurial
Branch
stable
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

Alphare created this revision.Jan 30 2020, 9:09 AM
marmoute accepted this revision.Feb 7 2020, 3:14 PM
marmoute added a subscriber: marmoute.

As you warned, this is not pretty. However that seems failry straightforward and does the job.

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.
Alphare updated this revision to Diff 20060.Feb 10 2020, 4:44 PM
kevincox added inline comments.Feb 12 2020, 5:01 AM
rust/hg-core/src/dirstate/dirstate_map.rs
251

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?