Skip to content
Snippets Groups Projects
  1. Feb 25, 2024
    • Pierre-Yves David's avatar
      branchcache: drop the unused `_verifyclosed` · 7e5bf298
      Pierre-Yves David authored
      This code appears dead since its introduction about 5 years ago in this three
      consecutive commits:
      
      - 6578654916ae → introduce the method with two calls
      - 7c9d4cf23adf → remove first call
      - be5eeaf5c24a → remove second call
      
      
          o  changeset:   be5eeaf5c24a
          |  user:        Pulkit Goyal <pulkit@yandex-team.ru>
          |  date:        Fri Apr 05 15:57:09 2019 +0300
          |  summary:     branchcache: don't verify closed nodes in _branchtip()
          |
          o  changeset:   7c9d4cf23adf
          |  user:        Pulkit Goyal <pulkit@yandex-team.ru>
          |  date:        Fri Apr 05 15:56:33 2019 +0300
          |  summary:     branchcache: don't verify closed nodes in iteropen()
          |
          o  changeset:   6578654916ae
          |  user:        Pulkit Goyal <pulkit@yandex-team.ru>
          ~  date:        Mon Apr 01 13:56:47 2019 +0300
             summary:     branchcache: lazily validate nodes from the branchmap
      7e5bf298
  2. Feb 26, 2024
  3. Feb 25, 2024
  4. Feb 19, 2024
    • Pierre-Yves David's avatar
      branchcache: fix the copy code · e13decaf
      Pierre-Yves David authored
      We copy some internal attribute along too. This should prevent inconsistency in
      the resulting branchmap.
      e13decaf
    • Pierre-Yves David's avatar
      branchcache: pass a "verify_node" attribut to __init__ instead of hasnode · f6d054ed
      Pierre-Yves David authored
      The hasnode callback cannot be inherited and is dropped on copy, which seems
      like a bad idea. Instead we pass the actual semantic as a parameter and let the
      internal logic deal with it.
      f6d054ed
    • Pierre-Yves David's avatar
      branchcache: stop storing a repository instance on the cache altogether · 6631ec9a
      Pierre-Yves David authored
      We did not really needed it and we do not needs it anymore at all. So lets make
      things simpler for consistency and garbage collecting and stop storing it
      altogether.
      6631ec9a
    • Pierre-Yves David's avatar
      branchcache: pass the target repository when copying · c99234d9
      Pierre-Yves David authored
      Branchmap are usually copied to be used on a different repoview using a
      different filter level. Passing the repository around means the repository in
      `branchcache._repo` will drift from the actual branchmap filter.
      
      This is currently "fine" because the repo is only used to retrieve the `nullid`
      value. However, this is a fairly big trap for any extension or future code using
      the `_repo` attribute.
      
      The replace logic is now using a copy to ensure the right repository view is
      used to initialized the cached value.
      
      We add a couple of assert for make sure this inconsistency does not sneak back.
      c99234d9
  5. Jan 19, 2024
  6. Feb 23, 2024
  7. Jan 17, 2024
    • Georges Racinet's avatar
      chainsaw-update: log actual locks breaking · fe68a2dc
      Georges Racinet authored
      Previously, the command would simply state that it was about
      to break locks, not if there was actually some to break.
      
      This version is race-free. It would be also possible to display
      the content of the lock before hand (not race-free but informative
      in almost all cases).
      fe68a2dc
    • Georges Racinet's avatar
      vfs: have tryunlink tell what it did · 187c5769
      Georges Racinet authored
      It is useful in certain circumstances to know whether vfs.tryunlink()
      actually removed something or not, be it for logging purposes.
      187c5769
  8. Nov 26, 2022
    • Georges Racinet's avatar
      chainsaw: new extension for dangerous operations · bc88aa74
      Georges Racinet authored
      The first provided command is `chainsaw-update`, whose one and single job is
      to make sure that it will pull, update and purge the target repository,
      no matter what may be in the way (locks, notably), see docstring for rationale.
      bc88aa74
  9. Feb 23, 2024
  10. Feb 22, 2024
    • Raphaël Gomès's avatar
      rust-index: remove one collect when converting back · 3099f1c6
      Raphaël Gomès authored
      Turns out this is slightly faster. Sending the results back to Python is still
      the most costly (like 75% of the time) of the whole method, but it's about
      as fast as it can be now.
      
      hg perf::phases on mozilla-try-2023-03-22
      before: 0.267114
      after:  0.247101
      3099f1c6
    • Raphaël Gomès's avatar
      rust-index: improve phase computation speed · 7c6d0b9d
      Raphaël Gomès authored
      While less memory efficient, using an array is *much* faster than using a
      HashMap, especially with the default hasher. It even makes the code simpler,
      so I'm not really sure what I was thinking in the first place, maybe it's more
      obvious now.
      
      This fix a significant performance regression when using the rust version of the
      code. (however, the C code still outperform rust on this operation)
      
      hg perf::phases on mozilla-try-2023-03-22
      - 6.6.3:  0.451239 seconds
      - before: 0.982495 seconds
      - after:  0.265347 seconds
      - C code: 0.183241 second
      7c6d0b9d
  11. Feb 23, 2024
    • Pierre-Yves David's avatar
      phases: directly update the phase sets in advanceboundary · 3cee8706
      Pierre-Yves David authored
      This is similar to what we do in retractboundary. There is no need to invalidate
      the cache if we have everything at hand to update it.
      3cee8706
    • Pierre-Yves David's avatar
      phases: large rework of advance boundary · 23950e39
      Pierre-Yves David authored
      In a similar spirit as the rework of retractboundary, the new algorithm is doing
      an amount of work in the order of magnitude of the amount of changeset that
      changes phases. (except to find new roots in impacted higher phases if any may
      exists).
      
      This result in a very significant speedup for repository with many old draft
      like mozilla try.
      
      runtime of perf:unbundle for a bundle constaining a single changeset (C code):
      
      before 6.7 phase work: 14.497 seconds
      before this change:     6.311 seconds (-55%)
      with this change:       2.240 seconds (-85%)
      
      Combined with the other patches that fixes the phases computation in the Rust
      index, the rust code with a persistent nodemap get back to quite interresting
      performances with 2.026 seconds for the same operation, about 10% faster than
      the C code.
      23950e39
  12. Feb 22, 2024
  13. Feb 21, 2024
    • Pierre-Yves David's avatar
      phases: filter revision that are already in the right phase · 2eb93812
      Pierre-Yves David authored
      No need to compute new roots if everything is already in order.
      2eb93812
    • Pierre-Yves David's avatar
      phases: invalidate the phases set less often on retract boundary · ac1c7518
      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%)
      ac1c7518
    • Pierre-Yves David's avatar
      phases: incrementally update the phase sets when reasonable · e57d4b86
      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".
      e57d4b86
  14. Feb 22, 2024
  15. Feb 21, 2024
  16. Feb 22, 2024
  17. Feb 21, 2024
  18. Feb 20, 2024
    • Pierre-Yves David's avatar
      phases: leverage the collected information to record phase update · eababb7b
      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.
      eababb7b
  19. Feb 21, 2024
    • Pierre-Yves David's avatar
      phases: large rewrite on retract boundary · 2f39c7ae
      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.
      2f39c7ae
  20. Feb 22, 2024
  21. Feb 21, 2024
  22. Feb 20, 2024
    • Pierre-Yves David's avatar
      phases: keep internal state as rev-num instead of node-id · f8bf1a8e
      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%)
      f8bf1a8e
Loading