• Daniel Bratell's avatar
    Speed up some really slow OWNERS operations for large/huge patches · b2b66999
    Daniel Bratell authored
    The current owners systems scales badly on the number of files in a
    patch, on the number of OWNERS files and on the number of "set noparent"
    rules. This patch addresses all three of those.
    
    If you have a patch with many (thousands) of files, you run into a lot
    of repeated work because the parent directories are visited for every
    file. By using a cache or remembering what directories have been
    visited, a lot of work can be avoided.
    
    If you have many OWNERS files or "set noparent" rules in scope of a
    patch, owners and stop_looking lookups became slow.  By splitting the
    rules by longest glob-free directory path, you get much smaller lists
    to process, which makes the code much faster.
    
    (Test case with "all the files" went from >15 minutes to 30 seconds).
    
    This saves about 2.5 second for git cl upload with a patch of
    350 files spread over the tree.
    
    The addition of many noparent rules in the Chromium tree might have
    been the major reason this is needed, but there are also more files to
    change, allowing larger patches.
    
    Bug: 920591
    Change-Id: If21178746ca9b88c2c07d265bd583b556d1734b7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1404172Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
    Auto-Submit: Daniel Bratell <bratell@opera.com>
    Commit-Queue: Daniel Bratell <bratell@opera.com>
    b2b66999
owners.py 21.6 KB