Skip to content
Snippets Groups Projects
  1. Feb 21, 2024
    • Pierre-Yves David's avatar
      phases: filter revision that are already in the right phase · 2eb93812d2a5
      Pierre-Yves David authored
      No need to compute new roots if everything is already in order.
      2eb93812d2a5
    • Pierre-Yves David's avatar
      phases: invalidate the phases set less often on retract boundary · ac1c75188440
      Pierre-Yves David authored
      We already have the information to update the phase set, so we do so directly
      instead of invalidating the cache.
      
      This show a sizeable speedup in our `perf::unbundle` benchmark on the
      many-draft mozilla-try repository.
      
      ### data-env-vars.name            = mozilla-try-2023-03-22-zstd-sparse-revlog
        # benchmark.name                = hg.perf.perf-unbundle
        # bin-env-vars.hg.flavor        = no-rust
        # bin-env-vars.hg.py-re2-module = default
        # benchmark.variants.issue6528  = disabled
      
        # benchmark.variants.revs = last-10
      before: 2.055259 seconds
      after:  1.887064 seconds (-8.18%)
        # benchmark.variants.revs = last-100
      before: 2.409239 seconds
      after:  2.222429 seconds (-7.75%)
        # benchmark.variants.revs = last-1000
      before: 3.945648 seconds
      after:  3.762480 seconds (-4.64%)
      ac1c75188440
    • Pierre-Yves David's avatar
      phases: incrementally update the phase sets when reasonable · e57d4b868a3e
      Pierre-Yves David authored
      When the amount of manual walking is small, we update the phases set manually
      instead of computing them from scratch. This should help small update. The next
      changesets will make this used more often by reducing the amount of full
      invalidation we do on roots upgrade.
      
      The criteria for using an incremental upgrade are arbitrary, however, it "should
      never hurt".
      e57d4b868a3e
  2. Feb 22, 2024
  3. Feb 21, 2024
  4. Feb 22, 2024
  5. Feb 21, 2024
  6. Feb 20, 2024
    • Pierre-Yves David's avatar
      phases: leverage the collected information to record phase update · eababb7b4a82
      Pierre-Yves David authored
      Since the lower level function already gather this information, we can directly
      use it.
      
      This comes with a small change to the test that are actually fixing them. The
      previous version over-reported some phase change that did not exists. In both
      case, we are force revision `1` to be secret and `0` remains draft`, the
      previous code wrongly reported `0` as moving to secret while it properly
      remained draft in the repository.
      eababb7b4a82
  7. Feb 21, 2024
    • Pierre-Yves David's avatar
      phases: large rewrite on retract boundary · 2f39c7aeb549
      Pierre-Yves David authored
      The new code is still pure Python, so we still have room to going significantly
      faster. However its complexity of the complex part is `O(|[min_new_draft, tip]|)` instead of
      `O(|[min_draft, tip]|` which should help tremendously one repository with old
      draft (like mercurial-devel or mozilla-try).
      
      This is especially useful as the most common "retract boundary" operation
      happens when we commit/rewrite new drafts or when we push new draft to a
      non-publishing server. In this case, the smallest new_revs is very close to the
      tip and there is very few work to do.
      
      A few smaller optimisation could be done for these cases and will be introduced in
      later changesets.
      
      We still have iterate over large sets of roots, but this is already a great
      improvement for a very small amount of work. We gather information on the
      affected changeset as we go as we can put it to use in the next changesets.
      This extra data collection might slowdown the `register_new` case a bit, however
      for register_new, it should not really matters. The set of new nodes is either
      small, so the impact is negligible, or the set of new nodes is large, and the
      amount of work to do to had them will dominate the overhead the collecting
      information in `changed_revs`.
      
      As this new code compute the changes on the fly, it unlock other interesting
      improvement to be done in later changeset.
      2f39c7aeb549
  8. Feb 22, 2024
  9. Feb 21, 2024
  10. Feb 20, 2024
    • Pierre-Yves David's avatar
      phases: keep internal state as rev-num instead of node-id · f8bf1a8e9181
      Pierre-Yves David authored
      Node-id are expensive to work with, dealing with revision is much simple and
      faster.
      
      The fact we still used node-id here shows how few effort have been put into
      making the phase logic fast. We tend to no longer use node-id internally for
      about ten years.
      
      This has a large impact of repository with many draft roots. For example this
      Mozilla-try copy have ½ Million draft roots and `perf::unbundle` see a
      significant improvement.
      
      ### data-env-vars.name            = mozilla-try-2023-03-22-zstd-sparse-revlog
        # benchmark.name                = hg.perf.perf-unbundle
        # bin-env-vars.hg.flavor        = no-rust
        # bin-env-vars.hg.py-re2-module = default
        # benchmark.variants.issue6528  = disabled
      
        # benchmark.variants.revs = last-1
      before:: 1.746791 seconds
      after::  1.278379 seconds  (-26.82%)
      
        # benchmark.variants.revs = last-10
      before:: 3.145774 seconds
      after::  2.103735 seconds  (-33.13%)
      
        # benchmark.variants.revs = last-100
      before:: 3.487635 seconds
      after::  2.446749 seconds  (-29.85%)
      
        # benchmark.variants.revs = last-1000
      before:: 5.007568 seconds
      after::  3.989923 seconds  (-20.32%)
      f8bf1a8e9181
    • Pierre-Yves David's avatar
      phases: do filtering at read time · 12881244e48a
      Pierre-Yves David authored
      This remove the need for the `filterunknown` method at all.
      12881244e48a
    • Pierre-Yves David's avatar
      phases: always write with a repo · 04111ef08fb0
      Pierre-Yves David authored
      In the future change that move the internal representation of phase-roots from
      node-id to rev-num, we will use a repository to translate revision numbers back
      to node at write time.
      
      Since that future change is quite complicated already, we do this small API
      change beforehand.
      04111ef08fb0
    • Pierre-Yves David's avatar
      phases: mark `phasecache.phaseroots` private · 68289ed170c7
      Pierre-Yves David authored
      We are about to change its content from nodeid to revnum. So anyone directly
      using the content might be in unexpected troubles. We start by making it private
      to explicitly break any such user (and discourage them to do so).
      68289ed170c7
    • Pierre-Yves David's avatar
      phases: check secret presence the right way during discovery · 2e10ddbb9faa
      Pierre-Yves David authored
      There is an official function for this, lets use it.
      
      This will prevent the code to break in the future while we refactor the phase
      code.
      2e10ddbb9faa
    • Pierre-Yves David's avatar
      phases: explicitly filter stripped revision at strip time · 8f2ea3fa50fd
      Pierre-Yves David authored
      Explicit is better than implicit. The current logic is bit subtle and fragile.
      
      It also get in the way of using something else than node-id as internal storage.
      We replace it with a more explicit filtering while striping.
      8f2ea3fa50fd
  11. Feb 23, 2024
    • Pierre-Yves David's avatar
      debug: add a debug::unbundle command that simulate the unbundle from a push · e2dfa403452d
      Pierre-Yves David authored
      The code have different behavior when the unbundle comes from a push, so we
      introduce a command that can simulate such unbundle.
      
      For our copy of mozilla-try-2023-03-22, this make the unbundle jump from 2.5
      seconds (with `hg unbundle`) to 15 seconds (with `hg debug::unbundle`).
      
      That 15 seconds timings is consistent with the issue seen in production.
      e2dfa403452d
  12. Feb 14, 2024
  13. Feb 12, 2024
    • Arseniy Alekseyev's avatar
      revlog: add a Rust implementation of `headrevsdiff` · b01e7d97e167
      Arseniy Alekseyev authored
      Python implementation of `headrevsdiff` can be very slow in the worst
      case compared with the `heads` computation it replaces, since the
      latter is done in Rust.
      
      Even the average case of this Python implementation is still
      noticeable in the profiles.
      
      This patch makes the computation much much faster by doing it in Rust.
      b01e7d97e167
  14. Dec 21, 2023
    • Arseniy Alekseyev's avatar
      revlog: add a C implementation of `headrevsdiff` · 3f37d80d3ab4
      Arseniy Alekseyev authored
      Python implementation of `headrevsdiff` can be very slow in the worst
      case compared with the `heads` computation it replaces, since the
      latter is done in C.
      
      Even the average case of this Python implementation is still
      noticeable in the profiles.
      
      This patch makes the computation much much faster by doing it in C.
      3f37d80d3ab4
    • Arseniy Alekseyev's avatar
      unbundle: faster computation of changed heads · a0d88b021a98
      Arseniy Alekseyev authored
      To compute the set of changed heads it's sufficient to look at the recent commits,
      instead of looking at all heads currently in existence.
      a0d88b021a98
  15. Feb 21, 2024
  16. Feb 20, 2024
  17. Feb 15, 2024
  18. Feb 14, 2024
  19. Feb 15, 2024
Loading