principle of stport std::sort

P

Pavel Pluhacek

Does anybody know how is working generic std::sort function in
stlport? I've tried to go through source code but it's too complex and
not commented.

I've tried to write as fast algorithm as I could (heapsort, quicksort)
but stlport's implementation has always beaten me with as much as 200%
better performance.

thx
 
P

Patrick Frankenberger

Pavel said:
Does anybody know how is working generic std::sort function in
stlport? I've tried to go through source code but it's too complex and
not commented.

I've tried to write as fast algorithm as I could (heapsort, quicksort)
but stlport's implementation has always beaten me with as much as 200%
better performance.

std::sort ist usually implemented using introsort, which is a quicksort
that detects degenerated cases and switches to heapsort then.

HTH,
Patrick
 
L

llewelly

Patrick Frankenberger said:
std::sort ist usually implemented using introsort, which is a
quicksort that detects degenerated cases and switches to heapsort
then.

Further, it may switch to insertion sort when the interval becomes small
(< 20 or so.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top