This is the mail archive of the
mailing list for the libstdc++ project.
Improvement to std::copy<>
- From: Dhruv Matani <dhruvbird at gmx dot net>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: 14 Aug 2003 21:48:50 +0530
- Subject: Improvement to std::copy<>
I went through the std::copy algorithm, and it seems that it uses the
insertion sort algorithm. I have tried to modify the unguarded insertion
function to be faster. The results show very minor improvements, but I
guess that can be improved. Now, instead of iterating through the entire
array form the last element, it uses binary sort to find the corerect
postion for insertion, and then uses std::copy backward to actually move
the elements, because copy backwward might be optimized for some data
types. I can post the code if needed.