Keep _NoPredNodes in a heap rather than a sorted array.
commit22373e152098d4befcdb5f4e1b6faee0bc7fed12
authormhagger <mhagger@be7e6eca-30d4-0310-a8e5-ac0d63af7087>
Sun, 4 Apr 2010 15:20:31 +0000 (4 15:20 +0000)
committermhagger <mhagger@be7e6eca-30d4-0310-a8e5-ac0d63af7087>
Sun, 4 Apr 2010 15:20:31 +0000 (4 15:20 +0000)
tree2fc9baaf1d8fe48c320d5c5dc046fd3d7c5cea13
parent5256a82b37d4484c8bd0ee875e9572ebd2caed50
Keep _NoPredNodes in a heap rather than a sorted array.

Problem discovered by: Brian Harring <ferringb@tigris.org>

From Brian (edited):
> The original implementation had several nasty cases; essentially,
> for adding a single node in, every time it required a full sort of
> the nodes list.  At least for gentoo-x86 cvs repo, several times we
> saw that list well past 20k items- the problem here is that 19,999
> of those items are already sorted yet each sort invocation requires
> checking each one to ensure ordering is sorted.

So maintain the no-pred nodes in a heap instead of a list to make
insertion and deletion O(lg N) operations.  The objects stored in the
heap are tuples which are constructed so as to sort in the right way.

git-svn-id: http://cvs2svn.tigris.org/svn/cvs2svn/trunk@5100 be7e6eca-30d4-0310-a8e5-ac0d63af7087
cvs2svn_lib/changeset_graph.py