Re: [PATCH] PR67085 move comparison functions in heap operations

2017-01-19 Thread Jonathan Wakely
On 19/01/17 20:24 +, Jonathan Wakely wrote: On 19/01/17 18:50 +, Jonathan Wakely wrote: On 19/01/17 18:28 +, Jonathan Wakely wrote: @@ -397,7 +401,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION while (__last - __first > 1) { --__last; - std::__pop_heap(__first,

Re: [PATCH] PR67085 move comparison functions in heap operations

2017-01-19 Thread Jonathan Wakely
On 19/01/17 18:50 +, Jonathan Wakely wrote: On 19/01/17 18:28 +, Jonathan Wakely wrote: @@ -397,7 +401,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION while (__last - __first > 1) { --__last; - std::__pop_heap(__first, __last, __last, __comp); + std::__pop_he

Re: [PATCH] PR67085 move comparison functions in heap operations

2017-01-19 Thread Jonathan Wakely
On 19/01/17 18:28 +, Jonathan Wakely wrote: @@ -397,7 +401,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION while (__last - __first > 1) { --__last; - std::__pop_heap(__first, __last, __last, __comp); + std::__pop_heap(__first, __last, __last, _GLIBCXX_MOVE(__comp

[PATCH] PR67085 move comparison functions in heap operations

2017-01-19 Thread Jonathan Wakely
This turns lots and lots of copies into moves, which can make a huge difference to performance (consider a std::function which has to allocate on every copy). PR libstdc++/67085 * include/bits/stl_heap.h (push_heap, __adjust_heap, __pop_heap) (pop_heap, __make_heap, make_h