This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug libstdc++/70898] Stateful Compare objects are very slow


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70898

gccbugs at jbapple dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|DUPLICATE                   |---

--- Comment #6 from gccbugs at jbapple dot com ---
I'm not sure I agree that this is a duplicate. In particular, 67085 says that
std::priority_queue operations "should not copy comparators". I suggested that
as well in my initial report, but upon a closer reading of the standard, I'm
not sure that would be conformant, since the standard requires
priorityy_queue::push to call std::push_heap, and std::push_heap has to take
its comparator by value.

On the other hand, I do think that copying comparators *fewer* times that
libstdc++ currently does is permitted, and I think it could have a big
performance benefit in some cases.

In particular, though push_heap seems like it must take the comparator by
value, __push_heap is not required to do so. The constructor for
__gnu_cxx::__ops::_Iter_comp_val and the function
__gnu_cxx::__ops::__iter_comp_val also do not have to take their comparators by
value.

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