debug mode performance patch

François Dumont francois.cppdevs@free.fr
Thu Nov 25 21:10:00 GMT 2010


On 11/24/2010 11:58 AM, Paolo Carlini wrote:
> Hi,
>> So here is my new attempt. This time with the changelog entry cause I 
>> feel like I am close to the final result :-)
> Indeed, I would say you are ;) Unless Jon has further comments today, 
> please just go ahead. Only two minor nits:
>
>     - In get_safe_base_mutex, I would just use size_t for the mask.
>     - I see something inconsistent in multithreaded_swap.cc vs the 
> current get_safe and in any case is affected by the issue with the 
> size of the long type. If you think the adjustments are straighforward 
> enough, no need to wait for approval but please post the final version 
> of the patch which goes in.
>
Hi

     Here is the patch I finally committed with your last remarks 
integrated. I also noticed a mistake on some C++0x experimental code. I 
then run test forcing this mode and there are several mistakes, I will 
surely submit patch for those too soon.

2010-11-25  François Dumont <francois.cppdevs@free.fr>

         * src/debug.cc: Introduce a mutex pool in get_safe_base_mutex.
         Move code used to manipulate sequence safe iterators from safe
         iterator methods to safe sequence ones. Remove usage of safe 
iterator
         mutex, keep _Safe_iterator_base::_M_get_mutex for library backward
         binary compatibility.
         * src/Makefile.am: Build debug.cc in gnu++0x mode for 
_Hash_impl usage.
         * src/Makefile.in: Regenerate
         * include/debug/safe_base.h: Add _Safe_iterator_base _M_invalidate
         and _M_reset. Add _Safe_sequence_base _M_attach, _M_attach_single,
         _M_detach and _M_detach_single.
         * include/debug.safe_iterator.h, safe_iterator.tcc: Remove
         _Safe_iterator _M_invalidate and _M_invalidate_single. 
Implement all
         methods in terms of normal iterators rather than safe ones.
         * include/debug/safe_sequence.h: Replace _Safe_sequence
         _M_transfe_iter with _M_transfer_from_if taking the source sequence
         and a predicate signaling when a safe iterator shall be transfered.
         Add _Equal_to predicate.
         * include/debug/safe_sequence.tcc: New.
         * include/Makefile.am: Adjust.
         * include/Makefile.in: Regenerate.
         * include/debug/forward_list: Swap safe iterators in move 
constructor.
         Do not invalidate before begin in _M_invalidate_all method.
         Reimplement safe methods using normal iterators rather than 
safe ones.
         * include/debug/set.h, unordered_map, multiset.h, vector,
         unordered_set, deque, map.h, list, multimap.h: Reimplement safe 
method
         using normal iterators rather than safe ones.
         * testsuite/23_containers/forward_list/debug/clear.cc, swap.cc,
         move_constructor.cc, splice_after.cc, splice_after1.cc,
         splice_after2.cc, splice_after3.cc, splice_after4.cc: New.
         * testsuite/23_containers/vector/debug/multithreaded_swap.cc: New.

Regards

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: performance.patch
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20101125/9b57a15c/attachment.ksh>


More information about the Libstdc++ mailing list