mirror of git://gcc.gnu.org/git/gcc.git
* sort.c (backtrace_qsort): Use middle element as pivot.
From-SVN: r208403
This commit is contained in:
parent
bc65bdd5b4
commit
dbe2084238
|
|
@ -1,3 +1,7 @@
|
||||||
|
2014-03-07 Ian Lance Taylor <iant@google.com>
|
||||||
|
|
||||||
|
* sort.c (backtrace_qsort): Use middle element as pivot.
|
||||||
|
|
||||||
2014-03-06 Ian Lance Taylor <iant@google.com>
|
2014-03-06 Ian Lance Taylor <iant@google.com>
|
||||||
|
|
||||||
* sort.c: New file.
|
* sort.c: New file.
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,12 @@ backtrace_qsort (void *basearg, size_t count, size_t size,
|
||||||
if (count < 2)
|
if (count < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* The symbol table and DWARF tables, which is all we use this
|
||||||
|
routine for, tend to be roughly sorted. Pick the middle element
|
||||||
|
in the array as our pivot point, so that we are more likely to
|
||||||
|
cut the array in half for each recursion step. */
|
||||||
|
swap (base, base + (count / 2) * size, size);
|
||||||
|
|
||||||
mid = 0;
|
mid = 0;
|
||||||
for (i = 1; i < count; i++)
|
for (i = 1; i < count; i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue