OSDN Git Service

Fixed a tiny bug in TimSort that slightly affects performance on small arrays
authorJoshua Bloch <jjb@google.com>
Thu, 16 Jul 2009 01:26:05 +0000 (18:26 -0700)
committerJoshua Bloch <jjb@google.com>
Thu, 16 Jul 2009 01:26:05 +0000 (18:26 -0700)
commit0b4b1277b22214587c438dacd84336b980063a1a
tree4df147f0f55d45fb0f30031c085646110085c053
parentf28359b2585f7f79958c16e3c146bdc3892cd9f9
Fixed a tiny bug in TimSort that slightly affects performance on small arrays
Martin Buchholz discovered this bug by running all tests with assertions
enabled.  That's the only way he could have discovered it, as it doesn't
affect correctness:) The assertion that failed was the one at the head of
countRunAndMakeAscending.  The cause was that I called the method with
(a, start, length) instead of (a, start, end).
libcore/luni/src/main/java/java/util/ComparableTimSort.java
libcore/luni/src/main/java/java/util/TimSort.java