Re: qsort again (was Re: [PERFORM] Strange Create Index

From: Neil Conway <neilc(at)samurai(dot)com>
To: "Steinar H(dot) Gunderson" <sgunderson(at)bigfoot(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: qsort again (was Re: [PERFORM] Strange Create Index
Date: 2006-02-16 19:14:03
Message-ID: 1140117243.31672.54.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On Thu, 2006-02-16 at 12:35 +0100, Steinar H. Gunderson wrote:
> glibc-2.3.5/stdlib/qsort.c:
>
> /* Order size using quicksort. This implementation incorporates
> four optimizations discussed in Sedgewick:
>
> I can't see any references to merge sort in there at all.

stdlib/qsort.c defines _quicksort(), not qsort(), which is defined by
msort.c. On looking closer, it seems glibc actually tries to determine
the physical memory in the machine -- if it is sorting a single array
that exceeds 1/4 of the machine's physical memory, it uses quick sort,
otherwise it uses merge sort.

-Neil

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2006-02-16 19:36:34 how solve diff of API counstruct_md_array between 8.1 and 8.2?
Previous Message Ron 2006-02-16 18:47:14 Re: qsort again (was Re: [PERFORM] Strange Create

Browse pgsql-performance by date

  From Date Subject
Next Message Adnan DURSUN 2006-02-16 22:14:56 Re: Why does not perform index combination
Previous Message Ron 2006-02-16 18:47:14 Re: qsort again (was Re: [PERFORM] Strange Create