Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unpack-trees:virtualfilesystem: Improve efficiency of clear_ce_flags #315

Commits on Feb 15, 2021

  1. unpack-trees:virtualfilesystem: Improve efficiency of clear_ce_flags

    When the virtualfilesystem is enabled the previous implementation of
    clear_ce_flags would iterate all of the cache entries and query whether
    each one is in the virtual filesystem to determine whether to clear one
    of the SKIP_WORKTREE bits. For each cache entry, we would do a hash
    lookup for each parent directory in the is_included_in_virtualfilesystem
    function.
    
    The former approach is slow for a typical Windows OS enlistment with
    3 million files where only a small percentage is in the virtual
    filesystem. The cost is
    O(n_index_entries * n_chars_per_path * n_parent_directories_per_path).
    
    In this change, we use the same approach as apply_virtualfilesystem,
    which iterates the set of entries in the virtualfilesystem and searches
    in the cache for the corresponding entries in order to clear their
    flags. This approach has a cost of
    O(n_virtual_filesystem_entries * n_chars_per_path * log(n_index_entries)).
    
    The apply_virtualfilesystem code was refactored a bit and modified to
    clear flags for all names that 'alias' a given virtual filesystem name
    when ignore_case is set.
    
    n_virtual_filesystem_entries is typically much less than
    n_index_entries, in which case the new approach is much faster. We wind
    up building the name hash for the index, but this occurs quickly thanks
    to the multi-threading.
    
    Signed-off-by: Neeraj Singh <[email protected]>
    neerajsi-msft2 committed Feb 15, 2021
    Configuration menu
    Copy the full SHA
    e063a87 View commit details
    Browse the repository at this point in the history