search/search_n vs find/find_if

Paolo Carlini pcarlini@suse.de
Wed Mar 2 10:58:00 GMT 2005


Hi everyone, hi Chris,

I'm working on the search_n issue (among other things, a dispatcher for 
random access iterators is neeeded, in order to do proper testing ;) and 
noticed something weird, in the v7-branch: in the unified implementation 
we have always local search loops also where, originally, std::find was 
called (non-predicated versions). Therefore, it looks like we are giving 
away an optimization (in the non-predicated case) when the iterators are 
random access. What should we do? Can you see anything wrong with 
calling find_if, instead? Actually, first blush, I don't understand why 
find_if was not exploited also in the original HP/SGI code...

By the way, Chris, about the "unrolling by hand" in 
std::find/std::find_if, which is the current situation, to your best 
knowledge?? Has -funroll-loops improved to the point that soon we can 
clean-up that ugliness and obtain well optimized code for a variety of 
targets?

Paolo.



More information about the Libstdc++ mailing list