I have a vector of pairs in my program, which I need to sort. Something as:
std::vector<std::pair<int, uintmax_t> > temp;
...
std::sort(temp.begin(), temp.end());
I performed some measurements and found out that for vector of size something over 16M of elements, the sorting takes 3 seconds when compiled with Intel C++ compiler and 25 seconds when compiled with GNU C++ compiler. This seems to be an extreme difference to me (more than 8 times slower using GNU).
Do you know any way how to make this program faster with GNU C++?
My configuration is Intel 12.1.5 and GNU 4.7.1. Unfortunately, I have no superuser rights on the computer I use for program runs.
Thanks for help in advance, Daniel.
EDIT: The optimization flag -O3 solved this issue, GNU C++ now takes 3 to 4 seconds. Thanks for hint, shame on me I have not figured out it myself :(. So, I hope this post will help someone else one day:).
Just for information, I did not specify any optimization flags within my measurements (maybe -O2 is default both for Intel and GNU?).