[Patch] libsdtc++/32908

Paolo Carlini pcarlini@suse.de
Sun Jul 29 17:35:00 GMT 2007


Hi,

this work turned out to be slightly less trivial than I thought because 
I didn't want to add too much duplicated code. Thus the idea of using 
the separate struct __lc_rai. Maybe a bit of analysis is in order to 
explain why a separate __newlast1 is not needed and we can simply assign 
to __last1. Note first that __last1 is only used in the final line of 
each function, in case it doesn't return early from inside the loop. In 
that case, clearly, __first1 == __newlast1. But then there is only one 
interesting possibility, __newlast1 < __last1. In that case, however, 
the loop ended with __first2 == __last2 and the function shall return 
false anyway.

After this interesting tweak (many thanks to Chris!), which actually, in 
my measurements, at least assuming the data is in the cache, speeds-up 
vector<int> comparison operators even more than the reported 15%, more 
like 20-25%, I would really leave these algorithms alone. We have bigger 
fish to fry, as Bjarne often repeats ;)

Patch tested x86/x86_64-linux, performance too.

Paolo.

//////////////////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_32908
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20070729/344d5043/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_32908
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20070729/344d5043/attachment-0001.ksh>


More information about the Libstdc++ mailing list