This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][libstdc++-v3 parallel mode] Enable user-defined swap


Hi

Sorry if this is trivial but I don't really understand the rational of such modifications.

It is supposed to have libstdc++ use user defined overloads of swap when available. But if so shouldn't it be overloaded in the std namespace ? I remember having read something like that but I am not sure it was in the C++ Standard or it was about the swap algo.

If we open libstdc++ to use swap defined in any namespace shouln't we do the same for all other algos used internally. For instance this patch use std::iter_swap, shouldn't it use:

using std::iter_swap;
iter_swap(...);

Regards

On 02/25/2011 03:09 PM, Johannes Singler wrote:
On 01/24/2011 07:12 PM, Benjamin Kosnik wrote:

Also commit to gcc-4_5-branch?

Ok.


-benjamin

The following patch enables user-defined swap for parallel sorting and the like, which can improve performance.


Tested x86_64-unknown-linux-gnu: No regressions

Committed.

2011-02-25 Johannes Singler <singler@kit.edu>

        PR libstdc++/47433
        * include/parallel/losertree.h
        (_LoserTree<>::__delete_min_insert):
        Do not qualify swap with std:: for value type,
        but include a using directive instead.
        (_LoserTreeUnguarded<>::__delete_min_insert): Likewise.
        * include/parallel/balanced_quicksort.h (__qsb_divide):
        Use std::iter_swap instead of std::swap.
        (__qsb_local_sort_with_helping): Likewise.
        * include/parallel/partition.h (__parallel_partition):
        Likewise. (__parallel_nth_element): Likewise.

Johannes



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]