[Patch] Performance and memory usage improvements for stl_tree.h

Gawain Bolton gp.bolton@computer.org
Wed Feb 26 21:59:00 GMT 2003


Nathan Myers wrote:

>On Wed, Feb 26, 2003 at 06:05:13PM +0100, Gawain Bolton wrote:
>  
>
>>Nathan Myers wrote:
>>    
>>
>>>On Sat, Feb 22, 2003 at 03:24:43PM +0100, Gawain Bolton wrote:
>>>      
>>>
>>>>This is an updated patch to improve stl_tree.h.  It affects the 
>>>>std::map, std::multimap, std::set and std::multiset container types. 
>>>>        
>>>>
>>>I vote to put this one in immediately.   The only think I'd fix along
>>>the way is some of the comments that go beyond 80 columns.
>>>      
>>>
>>Thanks for your comments Nathan.  I have fixed the problem concerning 
>>comments beyond 80 columns and removed the use of static_cast<> as this 
>>increased the  size of generated code bloat and is therefore probably 
>>less efficient than a C style cast.
>>    
>>
>
>If a C-style cast produced different object code than the static_cast<>,
>that probably indicates an error.  We like static_cast<> because it's
>easier to find with grep, and ugly enough that you try to avoid a need
>to do it at all.
>
>Nathan Myers
>ncm@cantrip.org
>  
>
Ok I checked this out and it turns out the code size was indeed reduced 
in the last patch, but it had nothing to do with static_cast<> vs. C 
style cast.  Strange.

So here is yet another patch using static_cast<> for the new code.  The 
existing code could be cleaned up in several ways, such as using 
static_cast<> elsewhere rather than C style casts.  I have tried to 
refrain from doing this to keep the purppose of this patch focused.  I 
am also trying to figure out how to contribute improvements to libstdc++ 
and  so want to start with something simple.


Gawain

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: stl_tree.h.patch
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20030226/b49a27a8/attachment.ksh>


More information about the Libstdc++ mailing list