sha1_name: avoid quadratic list insertion in handle_one_ref
commite8d1dfe639f71dc957c30c1eaa82a3ef0010cd8e
authorRené Scharfe <l.s.r@web.de>
Thu, 21 Aug 2014 18:30:29 +0000 (21 20:30 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Aug 2014 17:27:52 +0000 (25 10:27 -0700)
tree1bbf774206ef7766a568f19d855959fae88fb3c7
parentd31f3ad23dd1aee3c3e1015a43b02b995c01a9a1
sha1_name: avoid quadratic list insertion in handle_one_ref

Similar to 16445242 (fetch-pack: avoid quadratic list insertion in
mark_complete), sort only after all refs are collected instead of while
inserting.  The result is the same, but it's more efficient that way.
The difference will only be measurable in repositories with a large
number of refs.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c