Re: qsort, once again
От
Greg Stark
Тема
Re: qsort, once again
Дата
Msg-id
87acbjmqu8.fsf@stark.xeocode.com
Ответ на
Re: qsort, once again (Tom Lane)
Список
Дерево обсуждения
Re: qsort, once again "Dann Corbit" <DCorbit@connx.com>
Re: qsort, once again Tom Lane <tgl@sss.pgh.pa.us>
Re: qsort, once again Greg Stark <gsstark@mit.edu>
Re: qsort, once again Tom Lane <tgl@sss.pgh.pa.us>
Re: qsort, once again Greg Stark <gsstark@mit.edu>
Re: qsort, once again Tom Lane <tgl@sss.pgh.pa.us>
Tom Lane writes: > Greg Stark writes: > > That looks better both on average and in the worst case. Are the time > > constants that much worse that the merge sort still takes longer? > > Keep in mind that this is only counting the number of > comparison-function calls; it's not accounting for any other effects. > In particular, for a large sort operation quicksort might win because of > its more cache-friendly memory access patterns. My question explicitly recognized that possibility. I'm just a little skeptical since the comparison function in Postgres is often not some simple bit of tightly optimized C code, but rather a complex locale sensitive comparison function or even a bit of SQL expression to evaluate. Cache effectiveness is may be a minimal factor anyways when the comparison is executing more than a minimal amount of code. And one extra comparison is going to cost a lot more too. -- greg
В списке pgsql-hackers по дате отправления