• Bruce Dawson's avatar
    Increase presubmit --all speed (no diffs) by 100x · 5f63d3c4
    Bruce Dawson authored
    presubmit --all tells the presubmit system that all files are 'modified'
    but ChangedContents still goes off to see what changes are present. If
    most files were unchanged this was all handled perfectly, but if _all_
    files were unchanged then _GitDiffCache would interpret the empty
    dictionary of changes as a reason to ask git for diffs, millions of
    times. This made some checks take more than 100x as long. The overall
    effect on presubmit --all time is not known because I was never willing
    to wait the multiple days for them to terminate.
    
    That is, this would take many days to run:
      git checkout -b empty -t origin/main
      git cl presubmit --all
    
    whereas a single-character change to any file would let this run in
    about two hours.
    
    After three weeks of working on presubmits I only hit this twice which
    is why it took me so long to realize what the problem was.
    
    Bug: 1309977
    Change-Id: Ib280ea386107843b9174d835b0895316a5ed240c
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3589900Reviewed-by: 's avatarAravind Vasudevan <aravindvasudev@google.com>
    Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
    5f63d3c4
presubmit_support.py 70.3 KB