search/search_n vs find/find_if

Paolo Carlini pcarlini@suse.de
Wed Mar 2 19:41:00 GMT 2005


Chris Jefferson wrote:

> No, you could have said "Huh?!?"

;)

> What was worrying me was that I knew some functions (fill and copy it 
> turns out) have efficent specialisations, which I assumed would not 
> exist in the predicated versions, and therefore we might be losing 
> some performance. However now I look more carefully, there is no such 
> case, the only "type specific" specialisations are for fill, copy and 
> lexicographic_compare (which we haven't disturbed from before)

Good.

> Therefore my current plan goes something like:
>
> 1) Check through all the previously simplified algorithms for anywhere 
> where the non-predicate version uses find and the predicate version 
> doesn't use find_if, and knock out some test cases. 

Most probably, only search/search_n, but better double checking, right.

> 2) Try delegating find, count, replace, replace_copy, remove_copy and 
> remove to find_if, count_if, replace_if, replace_copy_if, 
> remove_copy_if and remove_if (while of course adding test cases). I've 
> looked at the tree output and x86, and they are very close (the 
> assembler isn't identical, but only differs when entering / leaving a 
> function. I hope to try to figure out why..)

Excellent plan!

Thanks,
Paolo.



More information about the Libstdc++ mailing list