read-cache: speed up add_index_entry during checkout
commite5494631ed94017da862d55eb6393a0d01d8b91d
authorJeff Hostetler <jeffhost@microsoft.com>
Wed, 19 Apr 2017 17:06:16 +0000 (19 17:06 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Apr 2017 03:33:01 +0000 (19 20:33 -0700)
tree82c6594b2b7203bd72c63a33fa243becafd27236
parent350d8701437f2d5031513bb45f1d14545d5a8911
read-cache: speed up add_index_entry during checkout

Teach add_index_entry_with_check() to see if the path
of the new item is greater than the last path in the
index array before attempting to search for it.

During checkout, merge_working_tree() populates the new
index in sorted order, so this change will save a binary
lookups per file.  This preserves the original behavior
but simply checks the last element before starting the
search.

This helps performance on very large repositories.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
read-cache.c