author | Julian Phillips <julian@quantumfyre.co.uk> | |
Thu, 29 Sep 2011 22:11:42 +0000 (23:11 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 30 Sep 2011 19:28:34 +0000 (12:28 -0700) | ||
commit | e9c4c11165e48b8f3fe1b4fc4db513f8e57202fb | |
tree | 0e5cc781ef4481edeb066d397c98e656d7caaba4 | tree | snapshot |
parent | b4f223c6367bb7aefa00c746c808f5afa7b85331 | commit | diff |
refs: Use binary search to lookup refs faster
Currently we linearly search through lists of refs when we need to
find a specific ref. This can be very slow if we need to lookup a
large number of refs. By changing to a binary search we can make this
faster.
In order to be able to use a binary search we need to change from
using linked lists to arrays, which we can manage using ALLOC_GROW.
We can now also use the standard library qsort function to sort the
refs arrays.
Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Currently we linearly search through lists of refs when we need to
find a specific ref. This can be very slow if we need to lookup a
large number of refs. By changing to a binary search we can make this
faster.
In order to be able to use a binary search we need to change from
using linked lists to arrays, which we can manage using ALLOC_GROW.
We can now also use the standard library qsort function to sort the
refs arrays.
Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c | diff | blob | history |