Skip to content
  • David Turner's avatar
    do_compare_entry: use already-computed path · d9c2bd56
    David Turner authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    In traverse_trees, we generate the complete traverse path for a
    traverse_info.  Later, in do_compare_entry, we used to go do a bunch
    of work to compare the traverse_info to a cache_entry's name without
    computing that path.  But since we already have that path, we don't
    need to do all that work.  Instead, we can just put the generated
    path into the traverse_info, and do the comparison more directly.
    
    We copy the path because prune_traversal might mutate `base`. This
    doesn't happen in any codepaths where do_compare_entry is called,
    but it's better to be safe.
    
    This makes git checkout much faster -- about 25% on Twitter's
    monorepo.  Deeper directory trees are likely to benefit more than
    shallower ones.
    
    Signed-off-by: default avatarDavid Turner <dturner@twopensource.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    d9c2bd56