Note:

This page is primarily intended for developers of Mercurial.

Dirstate Format Improvements Plan

1. Current state:

  1. The dirstate is stored in a file and reflects the state of all the files in the repository tracked by hg
  2. The dirstate is written in a random order (Python dict iteration)
  3. Status spends most of its time reading / parsing / using the dirstate and status is used in many highly used commands, here it what it does:
    1. Get the list of files that changed recently from hg watchman
    2. Read the entire dirstate, store it in memory
    3. Iterate through the dirstate and check the status of the file returned from watchman, we are interested in two questions:
      1. is the file in the dirstate?
      2. is the file modified/added/removed?
  4. For a dirstate of about ~100Mb on large repos, it takes 5s to build and write it and 350ms to read it

2. Improvement plan:

We can improve b, c.i and c.ii. a is not improvable easily.

c.i

c.ii

b


CategoryDeveloper CategoryNewFeatures