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++/51965] New: Redundant move constructions in heap algorithms


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51965

             Bug #: 51965
           Summary: Redundant move constructions in heap algorithms
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: valyala@gmail.com


Created attachment 26426
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26426
Eliminate unnecessary move constructions in stl_heap.h

Currently Heap implementation (
http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/include/bits/stl_heap.h?revision=181987&view=markup
) contains redundant move constructions. These constructors are invoked when
passing rvalue __value to std::__push_heap() and std::__adjust_heap(). It would
be better passing the __value into these functions by reference instead. This
eliminates redundant move constructions and results in 3x reduction of the
number of move constructor calls inside heap functions such as make_heap() and
sort_heap().

See the attached patch for details.


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