This is an archive of the discontinued Mercurial Phabricator instance.

rust: add `dirstate_tree` module
ClosedPublic

Authored by Alphare on Sep 25 2020, 12:05 PM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Commits
rHGb51167d70f5a: rust: add `dirstate_tree` module
Summary

Mercurial needs to represent the filesystem hierarchy on which it operates, for
example in the dirstate. Its current on-disk representation is an unsorted, flat
structure that gets transformed in the current Rust code into a HashMap.
This loses the hierarchical information of the dirstate, leading to some
unfortunate performance and algorithmic compromises.

This module adds an implementation of a radix tree that is specialized for
representing the dirstate: its unit is the path component. I have made no
efforts to optimize either its memory footprint or its insertion speed: they're
pretty bad for now.

Following will be a few patches that modify the dirstate.status logic to use
that new hierarchical information, fixing issue 6335 in the same swing.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Alphare created this revision.Sep 25 2020, 12:05 PM

This module adds an implementation of a radix tree that is specialized for
representing the dirstate: its unit is the path component.

But it still uses the flat format on disk so it's compatible? (I haven't looked at the code yet.)

But it still uses the flat format on disk so it's compatible? (I haven't looked at the code yet.)

Yes, no change to the format yet. I don't plan on pushing a format change until we get a clearer view of the performance (or lack thereof) and try out different things. It's probably a long way out.

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.