hashtable::erase and ::count enhancements

Paolo Carlini paolo.carlini@oracle.com
Fri Oct 7 00:07:00 GMT 2011


Hi,
> Hi
>
>     When working on hashtable code I found 2 small optimizations for 
> current hashtable implementation. In count method we know that all 
> equivalent elements are next to each others in the bucket so I split 
> the loop to stop counting once we found a not matching element in the 
> second loop. In erase, I did some refactoring and I avoid to call 
> _M_compare twice on the first matching node. I hope the unusual in 
> libstdc++ do/while is not a problem.
I'm wondering: why implementing this kind of tuning now, when we are in 
process of radically restructuring the whole thing for the obnoxious 
41975? Actually, I do like a lot the current simplicity of count, for 
example, while we are in the mindset of having to go through all the 
functions to adjust each one for the new datastructures. Thus, what I 
would suggest, at this time, if anything, let's just do the changes 
which purely simplify the code (or fix very serious bugs of course) and 
which we are reasonably sure are quite stable vs 41975, no microtuning. 
Also, at this time, I think we badly need testcases: for example any 
patch adding a consistent (thus map / multimap / set / multiset) set of 
testcases exercising count would be very welcome. erase seems less 
urgent (I remember adding some), still an audit seems in order.

Paolo.

PS: of course, I mean to give you some feedback about your ongoing 
experiments for 41975, just give a couple of days more. In general, I 
must say I like a lot the way you are proceeding, no rush, measure, try 
different data structures.



More information about the Libstdc++ mailing list