473,322 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

principle of stport std::sort

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
Jul 19 '05 #1
2 3606
Pavel Pluhacek wrote:
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

Jul 19 '05 #2
Patrick Frankenberger <p.*************@gmx.net> writes:
Pavel Pluhacek wrote:
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.


Further, it may switch to insertion sort when the interval becomes small
(< 20 or so.)
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: lok | last post by:
i have a class: template <class T1, class T2> class CPairMapping { public: typedef std::pair<T1, T2> ValuePair_t; typedef std::vector<ValuePair_t> ValueList_t; typedef std::binary_function<...
6
by: alexhong2001 | last post by:
Does "std::sort" work only with sequence containers, not associative containers at all? Among sequential containers, can it be used with "list", "queue" and other sequence containers besides...
1
by: Ravi | last post by:
I came across code which contains: std::sort<unsigned char*>((newAnswer.begin()+1),newAnswer.end()); with newAnswer defined as std::vector<unsigned char>& newAnswer However upon...
4
by: hall | last post by:
I accidently overloaded a static member function that I use as predicate in the std::sort() for a vector and ended up with a compiler error. Is this kind of overload not allowed for predicates and...
7
by: Ireneusz SZCZESNIAK | last post by:
I want to sort a vector with the std::sort function. There are two functions: one with two arguments, the other with three arguments. I am using the one with three arguments. I noticed that...
15
by: Peter Olcott | last post by:
Does anyone know how to do this?
5
by: fade | last post by:
Good afternoon, I need some advice on the following: I've got a class that has a member std::vector<CStringm_vFileName and a member CString m_path; The vector contains a bunch of filenames with...
11
by: Jeff Schwab | last post by:
Would std::sort ever compare an object with itself? I'm not talking about two distinct, equal-valued objects, but rather this == &that. The container being sorted is a std::vector. I've never...
1
by: Markus Dehmann | last post by:
In the following code example, I define several Comparator classes which contain different compare functions to use with std::sort. I have a Sorter class that gets passed a Comparator and is...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.